Files
great-powers/web/Dockerfile
T
jcoffey-dev e615726615 Give it a container and a page of its own
A Dockerfile that builds the bundle and serves it from nginx, matching the
three games already on the site, and the metadata a page needs when it is
somewhere rather than on a laptop: canonical, Open Graph, the two JSON-LD
blocks, and a noscript that describes the game rather than showing an empty
div to anybody who does not run scripts.

No dev proxy, unlike its siblings. They post scores to a shared service and
this one has nothing to post: a game of Diplomacy is not a number, and a
leaderboard reading "reached eleven centres" would be a worse thing to know
about somebody than nothing at all.

The favicon is seven powers round a board in the seven colours the map uses,
with the one supply centre in the middle they are all looking at -- drawn
here rather than drafted in a tool, like every other mark in this
repository.

And a way back out, absolute rather than "/": this is served from a
subdirectory in production and from the root in development, so the relative
answer is right in one of those and points at the game itself in the other.
2026-09-09 12:00:51 -07:00

25 lines
956 B
Docker

# The game is a static bundle. It is built here and served by nginx, in its own
# container - it shares nothing with the rest of the site but the domain.
#
# Unlike its siblings this one talks to no service at all. There is no score to
# post: a game of Diplomacy is not a number, and a leaderboard of "reached 11
# centres" would be a worse thing to know about somebody than nothing.
FROM node:26-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY tsconfig*.json vite.config.ts index.html ./
COPY public ./public
COPY src ./src
# Must match where the host proxies it, or the asset URLs will be wrong.
ARG BASE_PATH=/powers/
ENV BASE_PATH=${BASE_PATH}
RUN npm run build
FROM nginx:alpine
COPY web/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
CMD wget -qO- http://127.0.0.1:8080/healthz >/dev/null || exit 1