deploy: add Dockerfile + nginx config for static hosting

The web/ directory is fully self-contained (index.html + worklet.js, all JS
deps pulled from esm.sh via the importmap). Package it as a tiny nginx:alpine
image so Coolify can build + serve it behind Caddy.

- Dockerfile: nginx:1.27-alpine, copies web/ to the document root, healthcheck.
- nginx.conf: serves /, no-cache for index.html and worklet.js (so engine
  changes land immediately after a redeploy), short cache for everything else,
  gzip on text payloads, JS MIME for AudioWorklet.
- .dockerignore: keep the image small (excludes Python sources, docs,
  references, sandbox is included since it's served from /sandbox/).
This commit is contained in:
Jose Luis Montañes
2026-05-01 18:58:55 +02:00
parent 27f89b288e
commit d3786c9768
3 changed files with 69 additions and 0 deletions

14
Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
# code-sinth — static site served by nginx
# The web/ folder is fully self-contained (index.html + worklet.js).
# All JS dependencies are loaded from esm.sh via the importmap.
FROM nginx:1.27-alpine
# Replace the default nginx site config with one that serves /web/ at /,
# applies long cache for the worklet, and sets the right MIME types.
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY web/ /usr/share/nginx/html/
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost/ >/dev/null || exit 1