version: '3.9'

services:
  postgresql:
    image: docker.io/library/postgres:17
    container_name: postgresql
    environment:
      - POSTGRES_USER=${POSTGRES_USER:?POSTGRES_USER not set}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?POSTGRES_PASSWORD not set}
    networks:
      - postgresql
    volumes:
      - postgresql:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: unless-stopped
  
networks:
  postgresql:
    external: true

volumes:
  postgresql:
    external: true
