Files
support-fins/Dockerfile
kodin00 b401a656d1 docker: add compose + nginx image for one-command local deploy
The web app is a buildless static SPA (three.js is vendored in web/), so the
deploy image is just nginx serving web/ on :80. This adds:

- Dockerfile: nginx:stable-alpine, copies web/ + LICENSE, OCI labels.
- nginx.conf: port 80 site config that mirrors web/_redirects
  (/index.html and /index 301 -> /) via a $request_uri guard that cannot
  loop with the `index` directive's internal redirect; cache policy mirrors
  dev-server.py (no-store on the app's own JS/CSS/HTML) while long-caching
  the vendored three.js tree (immutable per image tag); absolute_redirect
  off so the redirect stays relative behind a reverse proxy.
- docker-compose.yml: one `web` service, host 8731:80 so the URL matches
  `python3 dev-server.py`, with a wget healthcheck.
- .dockerignore: excludes prototype/, plugin/, tests/, docs/, the dev
  servers and model files so the build context is just the web artifact.
- README: "Run with Docker" block pointing at the new files.

Validated: image builds, `nginx -t` passes, GET / -> 200 no-store,
GET /index.html|/index -> 301 relative /, GET /vendor/... -> immutable
long-cache, no redirect loop on /.
2026-09-21 20:29:14 +07:00

35 lines
1.5 KiB
Docker

# syntax=docker/dockerfile:1
#
# Support Fins is a buildless static SPA: three.js is vendored under web/vendor/
# and the whole app is plain ES modules loaded via an import map. There is no
# transpile/bundle step and no backend -- the image only needs to serve web/.
#
# nginx is used instead of the Python dev server because dev-server.py binds
# 127.0.0.1 (loopback only, unusable inside a container) and disables caching on
# purpose for development. nginx binds all interfaces and sets cache headers
# appropriate for an immutable image tag.
FROM nginx:stable-alpine
LABEL org.opencontainers.image.title="Support Fins" \
org.opencontainers.image.description="Browser-based breakaway support-fin generator for 3D prints" \
org.opencontainers.image.source="https://github.com/kodin00/support-fins" \
org.opencontainers.image.license="MIT"
# Site config: port 80, canonical-root redirects (mirroring web/_redirects), and
# a cache policy that matches the dev server's no-store on the app's own
# JS/CSS/HTML while long-caching the vendored three.js tree.
COPY nginx.conf /etc/nginx/conf.d/default.conf
# The entire shipped app is static files under web/.
COPY web/ /usr/share/nginx/html/
# MIT license -- kept in the image for license compliance.
COPY LICENSE /usr/share/licenses/support-fins/LICENSE
EXPOSE 80
# The official nginx image already runs `nginx -g 'daemon off;'` as its default
# CMD, so no override is needed -- the container stays in the foreground serving
# requests.