22# Java and Node are build tools only; the published image contains a jlink runtime.
33FROM node:26.10.0-alpine@sha256:0b36e8c136b94cd4fcf02188228e76c31ad5872eef3fec8cbd2eee500cfd9e80 AS node-toolchain
44
5+ FROM alpine:3.24.2@sha256:294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6 AS zlib-build
6+ RUN apk add --no-cache alpine-sdk ca-certificates dash=0.5.13.1-r2 && \
7+ adduser -D builder && addgroup builder abuild && \
8+ mkdir -p /build/zlib /build/dash /packages /out && chown -R builder:builder /build /packages /out
9+ COPY --chown=builder:builder docker/zlib/APKBUILD /build/zlib/APKBUILD
10+ COPY --chown=builder:builder docker/dash/APKBUILD /build/dash/APKBUILD
11+ USER builder
12+ WORKDIR /build/zlib
13+ RUN abuild-keygen -an && REPODEST=/packages abuild -r && \
14+ cp /packages/*/*/zlib-*.apk /out/zlib.apk && \
15+ cd /build/dash && REPODEST=/packages abuild -r && \
16+ cp /packages/*/*/dash-*.apk /out/dash.apk
17+
518FROM eclipse-temurin:25.0.4.1_1-jdk-alpine-3.24@sha256:3fd2d245c4e0eba615fe366a71b8bd25f5db7104f53e4026b24bf508b880bd2a AS backend-build
619RUN apk add --no-cache libstdc++ libatomic
720COPY --from=node-toolchain /usr/local/ /usr/local/
@@ -27,10 +40,14 @@ RUN mkdir /app/unpacked && cd /app/unpacked && \
2740 --output /opt/java-runtime
2841
2942FROM alpine:3.24.2@sha256:294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6 AS runtime-base
43+ COPY --from=zlib-build /out/zlib.apk /tmp/zlib.apk
44+ COPY --from=zlib-build /out/dash.apk /tmp/dash.apk
3045RUN apk upgrade --no-cache && \
31- apk add --no-cache ca-certificates libstdc++ zlib fontconfig font-dejavu && \
46+ apk add --no-cache --allow-untrusted /tmp/zlib.apk /tmp/dash.apk && rm /tmp/zlib.apk /tmp/dash.apk && \
47+ apk add --no-cache ca-certificates libstdc++ fontconfig font-dejavu curl && \
3248 addgroup -g 1001 -S spring && \
33- adduser -u 1001 -S spring -G spring
49+ adduser -u 1001 -S spring -G spring && \
50+ apk del --no-cache busybox busybox-binsh ssl_client
3451ENV JAVA_HOME=/opt/java
3552ENV PATH="$JAVA_HOME/bin:$PATH" \
3653 JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Djava.awt.headless=true"
@@ -40,19 +57,25 @@ COPY --from=backend-build --chmod=0444 /app/target/website-0.0.1-SNAPSHOT.jar /a
4057USER 1001:1001
4158EXPOSE 8080
4259HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
43- CMD wget -q -T 2 -O /dev/null http://127.0.0.1:8080/actuator/health || exit 1
60+ CMD [ "/usr/bin/dash" , "-ec" , "test \" $(curl --fail --silent --max-time 2 --output /dev/null --write-out '%{http_code}' http://127.0.0.1:8080/actuator/health) \" = 200" ]
4461ENTRYPOINT ["sh" , "-c" , "exec java $JAVA_OPTS -jar /app/app.jar" ]
4562
4663# Run the packaged app as the production UID to verify the linked Java modules,
4764# PDF extraction, content parsing, and the actual generated web assets.
4865FROM runtime-base AS smoke-test
49- RUN set -eu; \
66+ RUN --mount=type=bind,from=node-toolchain,source=/bin/busybox,target=/tmp/smoke-busybox \
67+ set -eu; \
68+ /tmp/smoke-busybox mkdir /tmp/website-smoke-tools; \
69+ /tmp/smoke-busybox --install -s /tmp/website-smoke-tools; \
70+ export PATH="/tmp/website-smoke-tools:$PATH" ; \
5071 test "$(id -u)" = 1001; \
72+ test ! -e /bin/busybox; \
73+ test ! -e /usr/bin/ssl_client; \
5174 test ! -e /opt/java/bin/javac; \
5275 java -version; \
5376 java $JAVA_OPTS -jar /app/app.jar > /tmp/website-smoke.log 2>&1 & \
5477 app_pid=$!; \
55- cleanup() { kill "$app_pid" 2>/dev/null || true; wait "$app_pid" 2>/dev/null || true; }; \
78+ cleanup() { kill "$app_pid" 2>/dev/null || true; wait "$app_pid" 2>/dev/null || true; /tmp/smoke-busybox rm -rf /tmp/website-smoke-tools; }; \
5679 trap cleanup EXIT; \
5780 attempt=0; \
5881 while [ "$attempt" -lt 60 ]; do \
@@ -63,6 +86,9 @@ RUN set -eu; \
6386 done; \
6487 if [ "$attempt" -ge 60 ]; then cat /tmp/website-smoke.log; exit 1; fi; \
6588 grep -Eq '"status"[[:space:]]*:[[:space:]]*"UP"' /tmp/website-health.json; \
89+ health_status="$(curl --fail --silent --max-time 5 --output /tmp/website-curl-health.json --write-out '%{http_code}' http://127.0.0.1:8080/actuator/health)" ; \
90+ test "$health_status" = 200; \
91+ grep -Eq '"status"[[:space:]]*:[[:space:]]*"UP"' /tmp/website-curl-health.json; \
6692 wget -T 5 -qO /tmp/website-client-info.json http://127.0.0.1:8080/api/client/info; \
6793 grep -Eq '"hostname"[[:space:]]*:[[:space:]]*"javadevjt[.]tech"' /tmp/website-client-info.json; \
6894 grep -Eq '"username"[[:space:]]*:[[:space:]]*"visitor"' /tmp/website-client-info.json; \
0 commit comments