services:

  php:
    build:
      context: .
      dockerfile: Dockerfile
    image: php_una:latest
    pull_policy: build
    environment:
      APACHE_DOCUMENT_ROOT: "/var/www/public"
      PHP_ERROR_LOG: "/var/www/public/logs/php.log"
    ports:
      - "8080:8080"
      - "8443:8443"
    volumes:
      - ".:/var/www"
    depends_on:
      - php_cron
    extra_hosts:
      - "${APP_DOCKER_HOST}:host-gateway"
      - "host.docker.internal:host-gateway"
    networks:
      - unacmsnet

  php_cron:
    image: php_una
    environment:
      PHP_ERROR_LOG: "/var/www/public/logs/php_cron.log"
    user: root
    command: [ "cron","-f" ]
    volumes:
      - ".:/var/www"
    depends_on:
      - mysql
    extra_hosts:
      - "${APP_DOCKER_HOST}:host-gateway"
      - "host.docker.internal:host-gateway"
    networks:
      - unacmsnet

  mailpit:
    image: axllent/mailpit
    restart: unless-stopped
    ports:
      - "8025:8025"
    environment:
      MP_MAX_MESSAGES: 5000
      MP_SMTP_AUTH_ACCEPT_ANY: 1
      MP_SMTP_AUTH_ALLOW_INSECURE: 1
    networks:
      - unacmsnet

  node:
    image: node:22-alpine
    volumes:
      - ".:/var/www"
    working_dir: "/var/www"
    entrypoint: [ "/bin/sh", "-c", "corepack enable yarn && exec \"\$@\"", "--" ]
    environment:
      COREPACK_ENABLE_DOWNLOAD_PROMPT: 0
      COREPACK_ENABLE_AUTO_PIN: 0
    networks:
      - unacmsnet

networks:
  unacmsnet:
    driver: bridge
volumes:
  mysqldata:
