rebours/docker-compose.prod.yml

68 lines
1.8 KiB
YAML

services:
fastify:
build:
context: .
dockerfile: Dockerfile
args:
- DATABASE_URL=${DATABASE_URL}
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
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
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: