services:
  postgres:
    image: postgres:16-alpine
    container_name: hoard-postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: hoard
      POSTGRES_USER: hoard
      POSTGRES_PASSWORD: hoard_dev_password
    ports:
      - "5432:5432"
    volumes:
      - hoard_postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U hoard -d hoard"]
      interval: 10s
      timeout: 5s
      retries: 5

  pgadmin:
    image: dpage/pgadmin4:9.3
    container_name: hoard-pgadmin
    restart: unless-stopped
    environment:
      PGADMIN_DEFAULT_EMAIL: familiehimmelberg@gmail.com
      PGADMIN_DEFAULT_PASSWORD: admin
      PGADMIN_CONFIG_SERVER_MODE: "False"
    ports:
      - "5050:80"
    depends_on:
      postgres:
        condition: service_healthy
    volumes:
      - hoard_pgadmin_data:/var/lib/pgadmin

volumes:
  hoard_postgres_data:
  hoard_pgadmin_data:
