-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
21 lines (19 loc) · 796 Bytes
/
Dockerfile
File metadata and controls
21 lines (19 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
FROM --platform=$BUILDPLATFORM docker.io/cyberbeni/swift-builder:latest AS swift-build
WORKDIR /workspace
COPY ./Package.swift ./Package.resolved /workspace/
RUN --mount=type=cache,target=/workspace/.spm-cache,id=spm-cache \
swift package \
--cache-path /workspace/.spm-cache \
--only-use-versions-from-resolved-file \
resolve
COPY ./scripts /workspace/scripts
COPY ./Sources /workspace/Sources
ARG TARGETPLATFORM
RUN --mount=type=cache,target=/workspace/.build,id=build-$TARGETPLATFORM \
--mount=type=cache,target=/workspace/.spm-cache,id=spm-cache \
scripts/build-release.sh && \
mkdir -p dist && \
cp .build/release/ExampleApp dist
FROM scratch AS release
COPY --from=swift-build /workspace/dist/ExampleApp /usr/local/bin/swift-example
ENTRYPOINT ["/usr/local/bin/swift-example"]