services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    ports:
      - "5432:5432"
    volumes:
      - pg_data:/var/lib/postgresql/data

  web:
    build: .
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: "postgres://postgres:postgres@postgres:5432/app"
      PORT: "3000"
    depends_on:
      postgres:
        condition: service_healthy

volumes:
  pg_data:
