Files
adamfandClaude Opus 5.5 30d6056bc0
Test and deploy / test (push) Successful in 1m35s
Test and deploy / deploy (push) Successful in 1m10s
Move the retired nginx and certbot into .deprecated
Nothing references nginx/ or certbot/ since the cutover to Caddy (daa2a46),
so they join quartz, hasura and autoheal in .deprecated/, with a README
entry on how to bring them back. The rollback steps in DEPLOYMENT.md §7 now
revert this commit and then the cutover. The host keeps ./certbot/conf (the
last certbot certificate, valid until 2027-01-20) and ./logs/nginx until the
rollback is no longer wanted; .gitignore still covers certbot/conf and
certbot/www for that reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-17 23:35:33 +00:00

55 lines
3.1 KiB
Docker

# =============================================================================
# nginx image — the public edge. Stock nginx plus two tools, three config
# templates, the two partials they include and two static includes.
#
# BASE: nginx:1.27, pinned to a minor version. Official nginx images are
# multi-arch, so the same tag resolves to the arm64 build on the Raspberry Pi
# with no platform pin needed — that is why there is no `--platform` anywhere
# in this repo.
#
# WHY THE EXTRA PACKAGES
# gettext-base provides `envsubst`, which entrypoint.sh uses to render a
# config template. Not in the base image.
# openssl used by entrypoint.sh to mint the self-signed localhost
# certificate in DEV_MODE only. Installed unconditionally
# because there is one image for both dev and production.
#
# `rm -rf /etc/nginx/html/*` clears the stock "Welcome to nginx" page, since
# that directory is where the vue_dist volume gets mounted and a leftover
# index.html there would be served if the Vue build ever failed.
#
# apt lists are deleted in the SAME RUN layer so they never end up in the image.
#
# NO nginx.conf IS COPIED IN. All three templates (plus the two partials) are,
# and entrypoint.sh picks one at container start. See nginx/entrypoint.sh for
# that decision. A new partial needs BOTH a COPY here and an envsubst render in
# the entrypoint, or nginx fails at start with "open() ... failed" on the
# include.
# =============================================================================
FROM nginx:1.27
RUN rm -rf /etc/nginx/html/* && \
apt-get update && apt-get install -y gettext-base openssl && \
rm -rf /var/lib/apt/lists/*
COPY nginx.conf.template /etc/nginx/nginx.conf.template
COPY nginx_setup.conf.template /etc/nginx/nginx_setup.conf.template
COPY nginx_dev.conf.template /etc/nginx/nginx_dev.conf.template
# Shared body of the dev :80 and :443 server blocks. entrypoint.sh renders it
# (same envsubst allow-list) to /etc/nginx/nginx_dev_common.conf, which is the
# path both `include` directives in nginx_dev.conf.template point at.
COPY nginx_dev_common.conf.template /etc/nginx/nginx_dev_common.conf.template
# The proxy route table shared by production and dev. entrypoint.sh renders it
# (same envsubst allow-list) to /etc/nginx/nginx_routes.conf, the path
# nginx.conf.template and nginx_dev_common.conf.template both `include`.
COPY nginx_routes.conf.template /etc/nginx/nginx_routes.conf.template
# Static security-header include, referenced from nginx.conf.template (and
# any location that sets its own add_header). Not templated — no envsubst.
COPY security_headers.conf /etc/nginx/security_headers.conf
# Static http-level include for the JSON request-body log (both configs). Not
# templated: its $request_body etc. are nginx variables, not env vars.
COPY payload_log.conf /etc/nginx/payload_log.conf
# The payload log's directory. Normally a bind mount (./logs/nginx); created
# here so nginx still starts when run without it.
RUN mkdir -p /var/log/nginx/payloads
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]