services:
  web:
    build: .
    ports:
      - "3000:3000"
    environment:
      PORT: 3000
      DATABASE_URL: postgres://pads:pads@db:5432/pads
      SESSION_SECRET: change-me
      ADMIN_USERNAME: admin
      ADMIN_PASSWORD: T5r4e3w2q1
    volumes:
      - uploads:/app/uploads
    depends_on:
      db:
        condition: service_healthy

  db:
    image: postgres:16
    environment:
      POSTGRES_USER: pads
      POSTGRES_PASSWORD: pads
      POSTGRES_DB: pads
    volumes:
      - pgdata:/var/lib/postgresql/data
      - ./db/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U pads -d pads"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  pgdata:
  uploads:
