【问题标题】:why is swift build failing on app engine?为什么快速构建在应用程序引擎上失败?
【发布时间】:2019-01-08 19:24:01
【问题描述】:

我正在从 here 运行教程,但似乎是在构建步骤中运行的,这可能只是我对 docker 的缺乏经验。我收到以下构建错误 'Munger-API' /root/Munger-API: error: could not find source files for target(s): Munger-API; use the 'path' property in the Swift 4 manifest to set a custom target path

Dockerfile:

FROM ibmcom/swift-ubuntu:latest
LABEL Description="Docker image for Swift + Perfect on Google App Engine flexible environment."

# Get extra dependencies for Perfect
RUN apt-get update && apt-get install -y \
openssl \
libssl-dev \
uuid-dev

# Expose default port for App Engine
EXPOSE 8080

# Copy sources
RUN mkdir /root/Munger-API
ADD Sources/Munger-API/main.swift /root/Munger-API
ADD Package.swift /root/Munger-API
ADD Sources/Munger-API/Controller/MungerController.swift /root/Munger-API
ADD Sources/Munger-API/Emailer/Emailer.swift /root/Munger-API

# Build the app
RUN cd /root/Munger-API && swift build

# Run the app
USER root
CMD ["/root/Munger-API/.build/debug/Munger-API"]

Package.swift

let package = Package(
name: "Munger-API",
products: [
    .executable(name: "Munger-API", targets: ["Munger-API"])
],
dependencies: [
    .package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", from: "3.0.0"),
    .package(url: "https://github.com/mhs2342/DAP-Munger-Model.git", from: "0.1.5"),
    .package(url: "https://github.com/PerfectlySoft/Perfect-SMTP.git", from: "3.0.0")
],
targets: [
    .target(name: "Munger-API",
            dependencies: [
                "PerfectHTTPServer",
                "DAP-Munger-Model",
                "PerfectSMTP"
            ],
            path: "root/Munger-API")
])

有人知道这里出了什么问题吗?

【问题讨论】:

    标签: swift docker google-app-engine google-cloud-platform perfect


    【解决方案1】:

    问题是 2 倍的。虽然我确实需要在Package.swift 中设置path 参数,但它必须是path: "",因为我已经将我的项目内容复制到root/DAP-Munger-API

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-22
      • 1970-01-01
      • 2021-11-16
      • 1970-01-01
      • 2022-08-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多