我正在从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")
])


任何人都对这里出了什么问题有深入的了解?

最佳答案

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

10-04 21:52