# The nordschleife multiplayer relay.
#
# A single Node process holding room state in memory. There is no database and
# nothing on disk: if this container restarts, every race in progress ends and
# players rejoin within a few seconds. That is an acceptable trade for a game
# relay, and it is why this image has no volumes.
FROM node:22-alpine
WORKDIR /app
# Dependencies first, so a change to server.js does not reinstall `ws`.
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
COPY server.js ./
# Matches the PORT default in server.js. Never published to the host: Caddy
# reaches this over the web-edge Docker network, so the relay is not directly
# addressable from the internet.
EXPOSE 8090
USER node
CMD ["node", "server.js"]