go-guess/frontend/Dockerfile
Daniel Noulet 570345e4b5 fix: write the runtime config in the web image too
The Kubernetes deployment runs the split go-guess-web image, which is a plain
nginx serving static files and never ran an entrypoint. The theme service origin
is therefore never written into runtime-config.js there, so the page would always
read the empty default and theming would be silently inert in the cluster while
working in local runs. The combined root image already did this; the split one
now does too.

The script lives beside the frontend Dockerfile because that image's build
context is ./frontend, which cannot see docker/.

The chart passes THEME_BASE_URL to the web container rather than the API: it is
read by the browser, not by the service. It stays absent when unset, so a
deployment with no theme service renders exactly as before.
2026-10-05 22:55:46 +02:00

18 lines
697 B
Docker

FROM node:26-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:1.29-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
# Writes runtime-config.js from the environment on start, so one image serves
# every environment instead of baking a hostname into the bundle at build time.
# It lives beside this Dockerfile because the build context is ./frontend.
COPY entrypoint.sh /usr/local/bin/go-guess-frontend-entrypoint
RUN chmod +x /usr/local/bin/go-guess-frontend-entrypoint
EXPOSE 80
ENTRYPOINT ["/usr/local/bin/go-guess-frontend-entrypoint"]
CMD ["nginx", "-g", "daemon off;"]