services:
  api:
    image: php
    build: .
    volumes:
      - .:/var/www/html
    ports:
      - "8080:80"
    networks:
      - app      
  db:
    image: "postgres:latest"
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: "photogeodata"
      POSTGRES_USER: "user" # Changed from root; Postgres best practice
      POSTGRES_PASSWORD: "password"
    volumes:
      - "appdb:/var/lib/postgresql/data"
    networks:
      - app   
networks:
  app:
    driver: bridge
volumes:
  appdb:
    driver: local