services:
  postgres:
    image: postgres:18
    container_name: sql-performance-lab
    environment:
      POSTGRES_DB: perflab
      POSTGRES_USER: lab
      POSTGRES_PASSWORD: lab
    command:
      - postgres
      - -c
      - shared_preload_libraries=pg_stat_statements
      - -c
      - compute_query_id=on
      - -c
      - track_io_timing=on
      - -c
      - log_temp_files=0
    ports:
      - "127.0.0.1:55432:5432"
    volumes:
      - sql-performance-data:/var/lib/postgresql
      - ./init.sql:/docker-entrypoint-initdb.d/10-init.sql:ro
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U lab -d perflab"]
      interval: 5s
      timeout: 3s
      retries: 20

volumes:
  sql-performance-data:
