64 lines
2.0 KiB
YAML
64 lines
2.0 KiB
YAML
name: manyangles
|
|
x-runtime: &runtime
|
|
env_file: ${RUNTIME_ENV_FILE:-.env.production}
|
|
environment:
|
|
NODE_ENV: production
|
|
DATABASE_URL: postgres://manyangles:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@postgres:5432/manyangles
|
|
restart: unless-stopped
|
|
init: true
|
|
security_opt: ["no-new-privileges:true"]
|
|
cap_drop: [ALL]
|
|
services:
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: manyangles
|
|
POSTGRES_USER: manyangles
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}
|
|
volumes: ["postgres-data:/var/lib/postgresql/data"]
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U manyangles -d manyangles"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
migrate:
|
|
<<: *runtime
|
|
restart: "no"
|
|
build: {context: ., target: migrate}
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
web:
|
|
<<: *runtime
|
|
build:
|
|
context: .
|
|
target: web
|
|
args:
|
|
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:?Set public HTTPS origin}
|
|
ports: ["127.0.0.1:3000:3000"]
|
|
depends_on:
|
|
migrate: {condition: service_completed_successfully}
|
|
healthcheck:
|
|
test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:3000/api/health/ready',{signal:AbortSignal.timeout(4000)}).then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
start_period: 20s
|
|
retries: 3
|
|
worker:
|
|
<<: *runtime
|
|
environment:
|
|
NODE_ENV: production
|
|
DATABASE_URL: postgres://manyangles:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@postgres:5432/manyangles
|
|
WORKER_HEALTH_PORT: "3001"
|
|
healthcheck:
|
|
test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:3001/health',{signal:AbortSignal.timeout(4000)}).then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
start_period: 30s
|
|
retries: 3
|
|
build: {context: ., target: worker}
|
|
depends_on:
|
|
migrate: {condition: service_completed_successfully}
|
|
volumes:
|
|
postgres-data:
|