diff --git a/docker-compose.simple.yml b/docker-compose.simple.yml new file mode 100644 index 0000000..644e447 --- /dev/null +++ b/docker-compose.simple.yml @@ -0,0 +1,55 @@ +version: '3.8' + +services: + backend: + image: node:22-alpine + working_dir: /app + environment: + - NODE_ENV=production + - JWT_SECRET=cad-jwt-secret-prod-2026 + - PORT=5000 + 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 server.js + 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 + 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 serve -s dist -l 80 + depends_on: + - backend + healthcheck: + test: ["CMD", "node", "-e", "require('http').get('http://localhost:80/',r=>{process.exit(r.statusCode===200?0:1)})"] + interval: 15s + timeout: 5s + retries: 15 + start_period: 90s + restart: unless-stopped