services:
  postgres:
    image: postgres:16
    container_name: postgres16
    restart: unless-stopped

    environment:
      POSTGRES_DB: training_system
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: admin1234

    ports:
      - "5432:5432"

    volumes:
      - postgres_data:/var/lib/postgresql/data

    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d mydatabase"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  postgres_data:
