services:
  postgres_db:
    image: postgres:latest # Use the latest official PostgreSQL image. Consider pinning to a specific version (e.g., postgres:15) for production.
    container_name: sts_sls_utility_postgres # A friendly name for the container
    restart: unless-stopped # Automatically restart the container unless it was manually stopped
    environment:
      POSTGRES_USER: sts-sls-utility # Sets the default username as requested
      POSTGRES_PASSWORD: MY_RANDOM_PASSWORD # Replace with a secure password
      POSTGRES_DB: sts-sls-utility
    volumes:
      # Mounts the host directory './postgres' into the container's data directory
      # This ensures data persists even if the container is removed and recreated.
      - ./postgres:/var/lib/postgresql/data
    ports:
      # Maps port 5432 on your host machine to port 5432 inside the container
      # You can change the host port if 5432 is already in use (e.g., "5433:5432")
      - "5432:5432"