normogen/backend/docker-compose.yml

67 lines
1.7 KiB
YAML

services:
mongodb:
image: mongo:7
container_name: normogen-mongodb
restart: unless-stopped
environment:
MONGO_INITDB_DATABASE: normogen
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
backend:
build: .
container_name: normogen-backend
restart: unless-stopped
ports:
- "6500:6500"
environment:
# The app reads NORMOGEN_* / MONGODB_* / APP_ENVIRONMENT (config/mod.rs).
- APP_ENVIRONMENT=production
- NORMOGEN_HOST=0.0.0.0
- NORMOGEN_PORT=6500
- MONGODB_URI=mongodb://mongodb:27017
- MONGODB_DATABASE=normogen
# Set real, strong values in your prod .env; production boot refuses insecure defaults.
- JWT_SECRET=${JWT_SECRET:?JWT_SECRET must be set}
- ENCRYPTION_KEY=${ENCRYPTION_KEY:?ENCRYPTION_KEY must be set}
- RUST_LOG=info
depends_on:
mongodb:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:6500/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
frontend:
build:
context: ..
dockerfile: web/normogen-web/Dockerfile
container_name: normogen-frontend
restart: unless-stopped
ports:
- "8080:8080"
environment:
- BACKEND_URL=http://backend:6500
- FRONTEND_PORT=8080
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:8080/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
volumes:
mongodb_data: