rebours/docker-compose.prod.yml
2026-03-12 15:37:59 +01:00

73 lines
2.0 KiB
YAML

services:
fastify:
build:
context: .
dockerfile: Dockerfile
volumes:
- static:/app/dist
environment:
- DATABASE_URL
- STRIPE_SECRET_KEY
- STRIPE_WEBHOOK_SECRET
- DOMAIN
- PORT=3000
- ADMIN_EMAIL
- ADMIN_PASSWORD
- COOKIE_SECRET
- NODE_ENV=production
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "sh", "-c", "[ -f /app/dist/index.html ] && wget -qO- http://localhost:3000/api/health || exit 1"]
interval: 10s
timeout: 5s
retries: 30
start_period: 60s
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.api.rule=Host(`rebours.studio`) && (PathPrefix(`/api`) || PathPrefix(`/admin`))
- traefik.http.routers.api.entrypoints=https
- traefik.http.routers.api.tls=true
- traefik.http.routers.api.tls.certresolver=letsencrypt
- traefik.http.services.api.loadbalancer.server.port=3000
- traefik.http.routers.api.priority=2
postgres:
image: postgres:16-alpine
volumes:
- pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_DB=rebours
- POSTGRES_USER=rebours
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rebours -d rebours"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
nginx:
image: nginx:alpine
volumes:
- static:/usr/share/nginx/html:ro
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
fastify:
condition: service_healthy
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.static.rule=Host(`rebours.studio`)
- traefik.http.routers.static.entrypoints=https
- traefik.http.routers.static.tls=true
- traefik.http.routers.static.tls.certresolver=letsencrypt
- traefik.http.services.static.loadbalancer.server.port=80
- traefik.http.routers.static.priority=1
volumes:
static:
pgdata: