-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (27 loc) · 1.49 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
35
36
FROM swift:5.9-amazonlinux2 as cheatsheet-executable-builder
WORKDIR /build
# First just resolve dependencies.
# This creates a cached layer that can be reused
# as long as your Package.swift/Package.resolved
# files do not change.
COPY ./Package.* ./
RUN swift package resolve --skip-update \
$([ -f ./Package.resolved ] && echo "--force-resolved-versions" || true)
# Copy entire repo into container
COPY . .
RUN swift build -c release
# RUN ls $(swift build --package-path . -c release --show-bin-path)
# RUN echo "$(swift build --package-path . -c release --show-bin-path)"
# RUN ls $(swift build --package-path . -c release --show-bin-path)
RUN cp "$(swift build --package-path . -c release --show-bin-path)/sync-command" ./bin/sync-command
RUN cp "$(swift build --package-path . -c release --show-bin-path)/arguments-1" ./bin/arguments-1
RUN cp "$(swift build --package-path . -c release --show-bin-path)/arguments-2" ./bin/arguments-2
RUN cp "$(swift build --package-path . -c release --show-bin-path)/flags-1" ./bin/flags-1
RUN cp "$(swift build --package-path . -c release --show-bin-path)/flags-2" ./bin/flags-2
RUN cp "$(swift build --package-path . -c release --show-bin-path)/flags-3" ./bin/flags-3
RUN cp "$(swift build --package-path . -c release --show-bin-path)/subcommands" ./bin/subcommands
# WORKDIR /libswift
# RUN cp -a /usr/lib/swift/linux/. ./
FROM scratch AS binaries
COPY --from=cheatsheet-executable-builder /build/bin ./
# COPY --from=cheatsheet-executable-builder /libswift ./libswift