- Replace socket.io relay with Colyseus 0.15 authoritative server - GameRoom with GameState schema (players, units, resources) - Pure TS services: CombatResolver, EconomyService, PathfindingService, UnitManager - POST /api/create-room → 4-char invite code - React/MUI LobbyScreen: Create (shows code + START GAME) / Join by code - ColyseusClient: joinOrCreate/join by room type = invite code - Nginx: static assets direct, all else proxied to Colyseus (WS upgrade) - Content-hashed JS bundles for Cloudflare cache-busting - 1-player lobbies: START GAME button bypasses 2-player wait
32 lines
743 B
Docker
32 lines
743 B
Docker
# Multi-stage build for Restitution
|
|
# Stage 1: Build (Node.js + webpack)
|
|
FROM node:20-alpine AS builder
|
|
|
|
# Install build deps for canvas (native module)
|
|
RUN apk add --no-cache build-base python3 cairo-dev pango-dev giflib-dev jpeg-dev
|
|
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm install --legacy-peer-deps
|
|
|
|
COPY . .
|
|
RUN npx webpack --mode production --output-path ./dist
|
|
|
|
# Stage 2: Backend (Colyseus authoritative server)
|
|
FROM node:20-alpine AS backend
|
|
|
|
WORKDIR /app
|
|
COPY gameServer/ ./
|
|
RUN npm install
|
|
EXPOSE 8081
|
|
CMD ["npm", "start"]
|
|
|
|
# Stage 3: Frontend (Nginx)
|
|
FROM nginx:alpine AS frontend
|
|
|
|
COPY --from=builder /app/dist/ /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|