Build the site image on Red Hat's hardened images
CI / test (pull_request) Successful in 41s

Node build on hi/nodejs:22-builder, the nginx config checked with `nginx -t` on
hi/nginx:latest-builder, served by the distroless hi/nginx runtime (UID 65532,
no shell). nginx keeps temp files in /tmp so the pod can run with a read-only
root filesystem; adds nosniff/referrer headers and hides the nginx version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 20:49:45 -05:00
co-authored by Claude Opus 5.5
parent bbea5db2ee
commit b9d692a91c
2 changed files with 39 additions and 12 deletions
+17 -6
View File
@@ -1,13 +1,24 @@
# The published Atlas page as a container: build the static site (npm run build -> dist/), then serve it with an
# unprivileged nginx on port 8080. .gitea/workflows/image.yml builds this on every push to main and pushes it to
# harbor.kenschiano.net/home/threshing-atlas:latest; Argo CD Image Updater rolls the deployment (kubefiles,
# web/threshing-atlas) when that digest changes.
FROM node:22-alpine AS build
# The published Atlas page as a container, on Red Hat's hardened images: build the static site with Node, check
# the nginx config with the nginx builder (it has a shell), then serve with the distroless nginx runtime (no shell
# or package manager, UID 65532, port 8080). .gitea/workflows/image.yml builds this on every push to main and
# pushes it to harbor.kenschiano.net/home/threshing-atlas:latest; Argo CD Image Updater rolls the deployment
# (kubefiles, web/threshing-atlas) when that digest changes.
ARG NODE_TAG=22
ARG NGINX_TAG=latest
FROM registry.access.redhat.com/hi/nodejs:${NODE_TAG}-builder AS build
# Only /site leaves this stage, so build as root
USER root
WORKDIR /src
COPY . .
RUN node site/build.js /site
FROM nginxinc/nginx-unprivileged:1.28-alpine
# Fail the build on a bad config, since the runtime image can't run `nginx -t` for us
FROM registry.access.redhat.com/hi/nginx:${NGINX_TAG}-builder AS nginx-check
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
RUN nginx -t -e /dev/stderr
FROM registry.access.redhat.com/hi/nginx:${NGINX_TAG}
COPY --from=nginx-check /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /site /usr/share/nginx/html
EXPOSE 8080