generated from Cyberbeni/MultiArchSwiftDockerfileExample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (30 loc) · 1.13 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM swift:6.0.2 AS build
WORKDIR /workspace
RUN swift sdk install \
https://download.swift.org/swift-6.0.2-release/static-sdk/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz \
--checksum aa5515476a403797223fc2aad4ca0c3bf83995d5427fb297cab1d93c68cee075
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/Wiring dist
FROM alpine:latest AS release
# https://pkgs.alpinelinux.org/contents
# ping: iputils-ping
# arp: net-tools
RUN apk add --no-cache \
iputils-ping \
net-tools \
tzdata
COPY --from=build /workspace/dist/Wiring /usr/local/bin/wiring
ENTRYPOINT ["/usr/local/bin/wiring"]