Tweaks and fixes throughout the project (#27)
This PR contains the work done to do a little bit of housekeeping pass across all packages and the Website service. To provide further details about the work: * Refreshed the READMEs and source documentation to match the current code; * Tagged every test case consistently across the Infrastructure, Localization, Persistence, and Website test targets; * Removed Website middleware tests now covered by Infrastructure's own suite; * Conformed the `PrepareDB` method to Sendable; * Relaxes the production Compose DATABASE_TLS default from require to prefer; * Added Persistence test verifying the prefer posture falls back to plaintext connections. Reviewed-on: rock-n-code/loud-amsterdam#27 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit is contained in:
+11
-14
@@ -8,14 +8,13 @@ ARG OXIPNG_VERSION=9.1.5
|
||||
ARG SVGO_VERSION=4.0.2
|
||||
|
||||
# Install the minifiers in their own layer, so they are cached across asset changes.
|
||||
# The oxipng pin is fuzzy (=~) so Alpine package revision bumps (-r0, -r1, ...) do
|
||||
# not break the build when the base image advances.
|
||||
# The oxipng pin is fuzzy (=~) so Alpine package revision bumps (-r0, -r1, ...) do not break the build when the base
|
||||
# image advances.
|
||||
RUN apk add --no-cache "oxipng=~${OXIPNG_VERSION}" \
|
||||
&& npm install --global "esbuild@${ESBUILD_VERSION}" "svgo@${SVGO_VERSION}"
|
||||
|
||||
# Copy the static files and minify the JS/CSS/SVG sources and losslessly recompress
|
||||
# the PNG images in place, keeping their names so the URL paths derived from the
|
||||
# StaticFile enumeration stay unchanged.
|
||||
# Copy the static files and minify the JS/CSS/SVG sources and losslessly recompress the PNG images in place, keeping
|
||||
# their names so the URL paths derived from the StaticFile enumeration stay unchanged.
|
||||
WORKDIR /static
|
||||
COPY ./Services/Website/Resources/Static .
|
||||
RUN esbuild --minify --allow-overwrite --outdir=css css/*.css \
|
||||
@@ -23,8 +22,8 @@ RUN esbuild --minify --allow-overwrite --outdir=css css/*.css \
|
||||
&& oxipng --opt max --strip safe *.png \
|
||||
&& svgo --recursive --folder .
|
||||
|
||||
# Export stage: `docker build --target assets-export --output <dir>` writes the
|
||||
# minified static files to <dir> for local inspection.
|
||||
# Export stage: `docker build --target assets-export --output <dir>` writes the minified static files to <dir> for
|
||||
# local inspection.
|
||||
FROM scratch AS assets-export
|
||||
COPY --from=assets /static /
|
||||
|
||||
@@ -44,17 +43,16 @@ RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||
WORKDIR /build
|
||||
|
||||
# First just resolve dependencies.
|
||||
# This creates a cached layer that can be reused as long as the manifests do
|
||||
# not change. The Website package depends on the local Localization package via
|
||||
# a relative path, so its manifest must be present for resolution to succeed.
|
||||
# This creates a cached layer that can be reused as long as the manifests do not change. The Website package depends on
|
||||
# the local Localization package via a relative path, so its manifest must be present for resolution to succeed.
|
||||
COPY ./Packages/Localization/Package.swift ./Packages/Localization/
|
||||
COPY ./Packages/Persistence/Package.swift ./Packages/Persistence/
|
||||
COPY ./Packages/Infrastructure/Package.swift ./Packages/Infrastructure/
|
||||
COPY ./Services/Website/Package.swift ./Services/Website/Package.resolved ./Services/Website/
|
||||
RUN swift package --package-path ./Services/Website resolve
|
||||
|
||||
# Copy only the Swift inputs needed for a release build. Static assets are built
|
||||
# in the assets stage and copied into staging after the binary is produced.
|
||||
# Copy only the Swift inputs needed for a release build. Static assets are built in the assets stage and copied into
|
||||
# staging after the binary is produced.
|
||||
COPY ./Packages/Infrastructure/Sources ./Packages/Infrastructure/Sources
|
||||
COPY ./Packages/Localization/Sources ./Packages/Localization/Sources
|
||||
COPY ./Packages/Persistence/Sources ./Packages/Persistence/Sources
|
||||
@@ -79,8 +77,7 @@ RUN cp "/usr/libexec/swift/linux/swift-backtrace-static" ./
|
||||
# Copy resources bundled by SPM to staging area
|
||||
RUN find -L "$(swift build --package-path /build/Services/Website -c release --show-bin-path)/" -regex '.*\.resources$' -exec cp -Ra {} ./ \;
|
||||
|
||||
# Create the static files directory (served by FileMiddleware) and fill it with
|
||||
# the minified copies from the assets stage
|
||||
# Create the static files directory (served by FileMiddleware) and fill it with the minified copies from the assets stage
|
||||
RUN mkdir -p ./Resources/Static
|
||||
COPY --from=assets /static ./Resources/Static
|
||||
|
||||
|
||||
Reference in New Issue
Block a user