services:
  postgres:
    image: postgres:17
    container_name: pg_ids_postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: pg_ids_test
      POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
    ports:
      - "9000:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./install.sql:/docker-entrypoint-initdb.d/01-install.sql:ro
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d pg_ids_test"]
      interval: 5s
      timeout: 5s
      retries: 5
      start_period: 10s
    restart: unless-stopped

volumes:
  postgres_data:
    driver: local
