Files
john-okeefe e2ae729a60 chore(docker): multi-stage build and registry run template
Dockerfile builds the Vite app in an oven/bun stage and serves
dist/ from the same nginx:stable-alpine-perl base as before,
plus the runtime-config entrypoint scripts. .env stays
dockerignored, so CI builds carry no backend URL and the image
is env-independent. Custom /etc/nginx/nginx.conf mounts keep
working (separate path from /docker-entrypoint.d/).

docker-compose.example.yml is a prod run template for
git.linuxhg.com/games-database/games-frontend (IMAGE_TAG,
default latest) with VITE_API_URL env (including the /api
suffix), restart policy, and a wget / healthcheck; traefik
setups drop ports for their labels/networks.
2026-09-06 12:49:14 -04:00

20 lines
667 B
Docker

# Multi-stage: build the Vite app here so CI produces an env-independent
# image (no .env needed at build time — the backend URL is injected at
# container start, see docker-entrypoint.d/30-frontend-config.sh).
FROM oven/bun:1 AS build
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build
FROM nginx:stable-alpine-perl
COPY --from=build /app/dist /usr/share/nginx/html
# nginx's entrypoint auto-runs *.sh in /docker-entrypoint.d/ on start.
# Unaffected by mounting a custom /etc/nginx/nginx.conf (separate path).
COPY docker-entrypoint.d/ /docker-entrypoint.d/
RUN chmod +x /docker-entrypoint.d/*.sh
EXPOSE 80