services:
  database:
    image: postgres:${POSTGRES_VERSION:-16}-alpine
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-app}
      # You should definitely change the password in production
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
      POSTGRES_USER: ${POSTGRES_USER:-app}
    healthcheck:
      test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}"]
      timeout: 5s
      retries: 5
      start_period: 60s
    ports:
      - 5432:5432
    volumes:
      - database_data:/var/lib/postgresql/data:rw
    networks:
      - app-network
    restart: unless-stopped

#  php:
#    build:
#      context: .
#      dockerfile: Dockerfile
#    ports:
#      - "5555:80"
#    depends_on:
#      - database
#    networks:
#      - app-network
#    restart: unless-stopped

volumes:
  database_data:

networks:
  app-network:
    driver: bridge