Files
vending-machine-game/Dockerfile
T
HamedandClaude Opus 5.5 47b2b72ea9
Deploy game to GitHub Pages / deploy (push) Failing after 21m51s
Add Docker deployment with automatic HTTPS
A two-stage image runs the tests and builds the game with Node, then
serves dist/ with Caddy, which obtains and renews Let's Encrypt
certificates for robotmarkets.ir (configurable via SITE_ADDRESS).
HTTPS is required for installing the PWA and for GPS mode.

- Caddyfile: gzip/zstd, long-lived caching for hashed assets, no-cache
  for the page, service worker and manifest, SPA fallback, permissions
  policy for location and motion sensors
- docker-compose.yml: ports 80/443, persistent certificate volumes
- README: server setup, updates, running behind an existing proxy, and
  workarounds when Docker Hub is unreachable from servers in Iran

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 09:59:01 +03:30

14 lines
437 B
Docker

# Stage 1: run the tests and build the static game with Vite.
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
RUN node --test tests/*.test.js && npm run build
# Stage 2: serve dist/ with Caddy, which also obtains and renews the HTTPS certificate.
FROM caddy:2.8.4-alpine
COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=build /app/dist /srv
EXPOSE 80 443 443/udp