Add Dockerfile, frontend image, and local compose stack

This commit is contained in:
megaproxy 2026-07-16 23:29:01 +01:00
parent ac72db9925
commit 3e2fbebac7
7 changed files with 199 additions and 1 deletions

28
Dockerfile Normal file
View file

@ -0,0 +1,28 @@
# Shattered Void MMO - backend (Express + WebSocket)
# bookworm-slim rather than alpine: bcrypt ships glibc prebuilds, musl would force a source build.
FROM node:20-bookworm-slim AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
FROM node:20-bookworm-slim AS runtime
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# winston-daily-rotate-file writes here but does not create the directory itself
RUN mkdir -p logs && chown -R node:node /app
USER node
EXPOSE 3000
HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=5 \
CMD curl -fsS http://localhost:3000/health || exit 1
CMD ["node", "src/server.js"]