version: "3"

services:
  database:
    container_name: postgres
    image: postgres:16.2-alpine
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 12345
      POSTGRES_HOST_AUTH_METHOD: trust
    ports:
      - "${DATABASE_PORT}:${DATABASE_PORT}"
    networks:
      - internal
  nginx:
    build:
      dockerfile: ./docker/nginx/Dockerfile
      args:
        COMPOSER_AUTH: "{}"
        APP_BASE_DIR: ${APP_BASE_DIR-.}
    volumes:
      - ".:/app"
      - './docker/nginx/default.conf:/etc/nginx/conf.d/default.conf'
    ports:
      - '${NGINX_PORT}:${NGINX_PORT}'
    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