@@ -15,8 +15,8 @@ RUN npx webpack --config webpack.prod.js
15
15
16
16
FROM swift:5.8-focal as swift
17
17
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
18
- && apt-get -q update && apt-get -q dist-upgrade -y \
19
- && apt-get install -y --no-install-recommends libsqlite3-dev \
18
+ && apt-get -q update \
19
+ && apt-get -q dist-upgrade -y \
20
20
&& rm -rf /var/lib/apt/lists/*
21
21
22
22
WORKDIR /build
@@ -25,27 +25,37 @@ COPY ./Package.* ./
25
25
RUN swift package resolve
26
26
27
27
COPY . .
28
- RUN swift build -c release
28
+ RUN swift build -c release --static-swift-stdlib
29
29
30
30
COPY ./Resources ./
31
- RUN cd Resources/formatter && swift build --product swift-format -c release
31
+ RUN cd Resources/formatter && swift build --product swift-format -c release --static-swift-stdlib
32
32
33
33
WORKDIR /staging
34
- RUN cp "$(swift build --package-path /build -c release --show-bin-path)/Run" ./ \
35
- && mv /build/Public ./Public && chmod -R a-w ./Public \
36
- && mv /build/Resources ./Resources && chmod -R a-w ./Resources
34
+
35
+ RUN cp "$(swift build --package-path /build -c release --show-bin-path)/App" ./
36
+
37
+ RUN find -L "$(swift build --package-path /build -c release --show-bin-path)/" -regex '.*\. resources$' -exec cp -Ra {} ./ \;
38
+
39
+ RUN [ -d /build/Public ] && { mv /build/Public ./Public && chmod -R a-w ./Public; } || true
40
+ RUN [ -d /build/Resources ] && { mv /build/Resources ./Resources && chmod -R a-w ./Resources; } || true
37
41
38
42
39
43
FROM swift:5.8-focal-slim
40
44
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
41
- && apt-get -q update && apt-get -q dist-upgrade -y && rm -r /var/lib/apt/lists/*\
42
- && useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor
45
+ && apt-get -q update \
46
+ && apt-get -q dist-upgrade -y \
47
+ && apt-get -q install -y \
48
+ ca-certificates \
49
+ tzdata \
50
+ && rm -r /var/lib/apt/lists/*
51
+
52
+ RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor
43
53
44
54
WORKDIR /app
45
55
COPY --from=swift --chown=vapor:vapor /staging /app
46
56
47
57
USER vapor:vapor
48
58
EXPOSE $PORT
49
59
50
- ENTRYPOINT ["./Run " ]
60
+ ENTRYPOINT ["./App " ]
51
61
CMD ["serve" , "--env" , "production" , "--hostname" , "0.0.0.0" ]
0 commit comments