services: postgres: image: postgres:latest restart: unless-stopped environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB} volumes: # PostgreSQL 18+ images store data in a version-specific subdirectory # under /var/lib/postgresql (pg_ctlcluster-style layout) rather than # directly at /var/lib/postgresql/data; mounting the old path makes # the container refuse to start. - fantastick-postgres-data:/var/lib/postgresql healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 5s timeout: 5s retries: 10 start_period: 15s # One-shot job that applies Prisma migrations before app/queue-worker start. # Safe to run on every `docker compose up`; `prisma migrate deploy` is a no-op # if there is nothing new to apply. migrate: build: context: . target: build command: ["pnpm", "exec", "prisma", "migrate", "deploy"] restart: "no" depends_on: postgres: condition: service_healthy env_file: .env environment: DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?schema=public app: # Pre-built by CI on every release; `docker compose pull app queue-worker` # fetches it instead of building locally. `build:` is still here so # `docker compose build` (or `up --build`) works from source too. image: ghcr.io/wentthefox/fantastick:latest build: context: . target: runtime restart: unless-stopped depends_on: postgres: condition: service_healthy migrate: condition: service_completed_successfully env_file: .env environment: DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?schema=public volumes: - fantastick-sticker-storage:/app/fs queue-worker: image: ghcr.io/wentthefox/fantastick:latest build: context: . target: runtime command: ["node", "--enable-source-maps", "build/src/queue-worker.js"] restart: unless-stopped depends_on: postgres: condition: service_healthy migrate: condition: service_completed_successfully env_file: .env environment: DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?schema=public volumes: - fantastick-sticker-storage:/app/fs volumes: fantastick-postgres-data: # Shared between app and queue-worker: sticker files uploaded via Discord # are written by app and read by queue-worker when re-rendering galleries. fantastick-sticker-storage: