sanch
sanch

Reputation: 716

why is swift build failing on app engine?

I am running the tutorial from here but seem to be running in a build step that is likely just my inexperience with docker. I get the following build error '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")
])

Anyone have some insight into what's going wrong here?

Upvotes: 0

Views: 137

Answers (1)

sanch
sanch

Reputation: 716

The problem was 2-fold. While I did need to have the path argument set in my Package.swift, but it needed to be path: "" which makes sense as I was copying the contents of my project to root/DAP-Munger-API already.

Upvotes: 0

Related Questions