Files
web-cad/docker-compose.simple.yml
T

81 lines
1.9 KiB
YAML
Raw Normal View History

version: '3.8'
services:
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_USER=webcad
- POSTGRES_PASSWORD=webcad
- POSTGRES_DB=webcad
volumes:
- pg_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U webcad"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
backend:
image: node:22-alpine
working_dir: /app
environment:
- NODE_ENV=production
- JWT_SECRET=cad-jwt-secret-prod-2026
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=webcad
- DB_PASSWORD=webcad
- DB_NAME=webcad
expose:
- "5000"
command:
- sh
- '-c'
- |
apk add --no-cache git
git clone --depth 1 https://forgejo.media-on.de/Leopoldadmin/web-cad.git /tmp/repo
cp -r /tmp/repo/backend/* /app/
rm -rf /tmp/repo
npm ci --only=production
node seed.js && node server.js
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:5000/api/health',r=>{process.exit(r.statusCode===200?0:1)})"]
interval: 15s
timeout: 5s
retries: 15
start_period: 40s
restart: unless-stopped
frontend:
image: node:22-alpine
working_dir: /app
expose:
- "80"
command:
- sh
- '-c'
- |
apk add --no-cache git curl
git clone --depth 1 https://forgejo.media-on.de/Leopoldadmin/web-cad.git /tmp/repo
cp -r /tmp/repo/frontend/* /app/
rm -rf /tmp/repo
npm ci
npx vite build --mode production
npx vite preview --host 0.0.0.0 --port 80
depends_on:
- backend
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 15s
timeout: 5s
retries: 15
start_period: 120s
restart: unless-stopped
volumes:
pg_data: