feat: production deployment — Dockerfile, docker-compose, SPA serving, classic bot fights
- Add Dockerfile (multi-stage: build frontend + server, serve from single container) - Add docker-compose.yml for Portainer stack deployment - Server serves frontend SPA in production (static assets + SPA fallback) - Auto-run migrations and seed mock bots on server startup - DB path configurable via DB_PATH env var - Add "Fight a Classic Bot" button for instant mock bot matches - FIGHT button queues for real AI opponents Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
120250c01a
commit
6bf9fe27b3
+43
@@ -0,0 +1,43 @@
|
||||
# Stage 1: Install dependencies
|
||||
FROM node:22-slim AS deps
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
||||
COPY frontend/package.json frontend/
|
||||
COPY server/package.json server/
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Stage 2: Build frontend
|
||||
FROM deps AS build-fe
|
||||
COPY frontend/ frontend/
|
||||
RUN pnpm --filter frontend build
|
||||
|
||||
# Stage 3: Build server
|
||||
FROM deps AS build-be
|
||||
COPY server/ server/
|
||||
RUN pnpm --filter server build
|
||||
|
||||
# Stage 4: Production image
|
||||
FROM node:22-slim AS production
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
||||
COPY server/package.json server/
|
||||
RUN pnpm install --filter server --prod --frozen-lockfile
|
||||
|
||||
# Copy built server
|
||||
COPY --from=build-be /app/server/dist server/dist
|
||||
|
||||
# Copy built frontend into server's public dir
|
||||
COPY --from=build-fe /app/frontend/dist server/public
|
||||
|
||||
# Data volume for SQLite
|
||||
RUN mkdir -p /app/server/data
|
||||
VOLUME /app/server/data
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=9100
|
||||
EXPOSE 9100
|
||||
|
||||
CMD ["node", "server/dist/index.js"]
|
||||
Reference in New Issue
Block a user