version: "3"

services:
  database:
    container_name: postgres
    image: postgres:16.2-alpine
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_HOST_AUTH_METHOD: trust
    ports:
      - "${DATABASE_PORT}:5432"
    networks:
      - internal
  nginx:
    build:
      dockerfile: ./docker/nginx/Dockerfile
      args:
        COMPOSER_AUTH: "{}"
        APP_BASE_DIR: ${APP_BASE_DIR-.}
    volumes:
      - ".:/app"
    ports:
      - '${NGINX_PORT}:80'
    networks:
      - internal
  app:
    build:
      dockerfile: ./docker/php/Dockerfile
      args:
        COMPOSER_AUTH: "{}"
        APP_BASE_DIR: ${APP_BASE_DIR-.}
    volumes:
      - ".:/app"
    restart: unless-stopped
    networks:
      - internal

networks:
  internal:
    driver: bridge