@@ -15,8 +15,8 @@ RUN npx webpack --config webpack.prod.js
1515
1616FROM swift:5.8-focal as swift
1717RUN 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 \
2020 && rm -rf /var/lib/apt/lists/*
2121
2222WORKDIR /build
@@ -25,27 +25,37 @@ COPY ./Package.* ./
2525RUN swift package resolve
2626
2727COPY . .
28- RUN swift build -c release
28+ RUN swift build -c release --static-swift-stdlib
2929
3030COPY ./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
3232
3333WORKDIR /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
3741
3842
3943FROM swift:5.8-focal-slim
4044RUN 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
4353
4454WORKDIR /app
4555COPY --from=swift --chown=vapor:vapor /staging /app
4656
4757USER vapor:vapor
4858EXPOSE $PORT
4959
50- ENTRYPOINT ["./Run " ]
60+ ENTRYPOINT ["./App " ]
5161CMD ["serve" , "--env" , "production" , "--hostname" , "0.0.0.0" ]
0 commit comments