services:
  db:
    image: postgres:16-alpine
    container_name: brackt-db
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: brackt
    ports:
      - "5439:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5

  app:
    build: .
    container_name: brackt-app
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgres://postgres:postgres@db:5432/brackt
      NODE_ENV: production
    depends_on:
      db:
        condition: service_healthy
    profiles:
      - full

volumes:
  postgres_data:
