feat: Docker Compose avec Node.js pré-compilé pour déploiement sans npm

This commit is contained in:
2026-02-05 01:50:40 +01:00
parent 1228a02221
commit ba48c760c5
2 changed files with 18 additions and 14 deletions

View File

@@ -2,17 +2,11 @@ FROM node:18-alpine
WORKDIR /app WORKDIR /app
# Copy npm config
COPY .npmrc ./
# Copy package files # Copy package files
COPY backend/package*.json ./ COPY backend/package*.json ./
# Install dependencies - handle npm bug with explicit install # Copy pre-built node_modules (already present)
RUN npm cache clean --force && \ COPY backend/node_modules ./node_modules/
npm install --no-optional --legacy-peer-deps || true && \
npm install express express-session bcryptjs dotenv cors multer fs-extra && \
test -d node_modules/express || (ls -la node_modules/ && echo "FATAL: express not found" && exit 1)
# Copy application code # Copy application code
COPY backend/src ./src COPY backend/src ./src

View File

@@ -1,20 +1,30 @@
version: '3.8'
services: services:
app: app:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: webnationsglory-admin
environment: environment:
NODE_ENV: production NODE_ENV: production
PORT: 4001 PORT: 4001
SERVER_DIR: /mc-server SERVER_DIR: /home/innotex/NationsGloryRED/NationsGlory_ServeurBuild_Red
RCON_HOST: localhost RCON_HOST: localhost
RCON_PORT: 25575 RCON_PORT: 25575
SESSION_SECRET: change-this-in-production SESSION_SECRET: your-secret-key-change-in-production
volumes: volumes:
- /NationsGloryRED/NationsGlory_ServeurBuild_Red:/mc-server - /home/innotex/NationsGloryRED/NationsGlory_ServeurBuild_Red:/mc-server
- web-admin:/mc-server/.web-admin - web-admin-data:/app/data
ports:
- "4001:4001"
restart: unless-stopped restart: unless-stopped
network_mode: host healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4001/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes: volumes:
web-admin: web-admin-data: