Hardened the Docker build of the Website service target.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# ================================
|
||||
# Asset image
|
||||
# ================================
|
||||
FROM node:22-alpine AS assets
|
||||
FROM node:22-alpine@sha256:c610fcdfb1d5b4740dd70c284ed3cb16bb857e0f7166196e36a5501df7a3aa32 AS assets
|
||||
|
||||
ARG ESBUILD_VERSION=0.28.1
|
||||
ARG OXIPNG_VERSION=9.1.5
|
||||
@@ -30,7 +30,7 @@ COPY --from=assets /static /
|
||||
# ================================
|
||||
# Build image
|
||||
# ================================
|
||||
FROM swift:6.3-noble AS build
|
||||
FROM swift:6.3-noble@sha256:69bf1f0281e13d82c9e49d67c2dd1dcc8c00bad738c860f4323d7078787ec8ea AS build
|
||||
|
||||
# Install OS updates
|
||||
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||
@@ -59,10 +59,15 @@ COPY ./Packages/Localization/Sources ./Packages/Localization/Sources
|
||||
COPY ./Packages/Persistence/Sources ./Packages/Persistence/Sources
|
||||
COPY ./Packages/Utility/Sources ./Packages/Utility/Sources
|
||||
COPY ./Services/Website/Sources ./Services/Website/Sources
|
||||
COPY ./Services/Website/Tests ./Services/Website/Tests
|
||||
|
||||
# Build the application, with optimizations, with static linking, and using jemalloc
|
||||
RUN swift build --package-path ./Services/Website -c release \
|
||||
# Build the application, with optimizations, with static linking, and using jemalloc.
|
||||
#
|
||||
# SPM validates the path of every target in the root package — including the test targets — even when only the
|
||||
# executable product is built, so those directories have to exist. They are created empty instead of copied: the test
|
||||
# sources are not needed to compile the product, keeping them out means editing a test never invalidates this layer,
|
||||
# and it keeps the local database bind mount under Tests/DB out of the image entirely.
|
||||
RUN mkdir -p ./Services/Website/Tests/App ./Services/Website/Tests/Library \
|
||||
&& swift build --package-path ./Services/Website -c release \
|
||||
--product "Website" \
|
||||
--static-swift-stdlib \
|
||||
-Xlinker -ljemalloc
|
||||
@@ -89,7 +94,7 @@ RUN chmod -R a-w ./Resources
|
||||
# ================================
|
||||
# Run image
|
||||
# ================================
|
||||
FROM ubuntu:noble
|
||||
FROM ubuntu:noble@sha256:561618e2c15bf2397621dd04f96926663a3b5616c189cf7e38db7e82f5c538ea
|
||||
|
||||
# Make sure all system packages are up to date, and install only essential packages.
|
||||
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||
|
||||
Reference in New Issue
Block a user