name: api
services:
    api-php:
        build:
            context: ../../../infra/docker/php84-fpm
        volumes:
            - ${DOCUMENT_ROOT:-./www}:/var/www/html
            - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
        networks: [ api-priv, mozart-network ]
        extra_hosts:
            - "host.docker.internal:host-gateway"
    nginx-docker:
        image: nginx:alpine
        depends_on: [ api-php ]
        environment:
            SERVER_NAME: ${SERVER_NAME}
        volumes:
            - ${DOCUMENT_ROOT:-./www}:/var/www/html:ro
            - ./config/nginx/conf.d:/etc/nginx/conf.d
            - ./config/nginx/auth/${ENV:-local}:/etc/nginx/auth
        networks: [ api-priv, mozart-network ]
        expose:
            - "80"
        labels:
            - traefik.enable=true
            - traefik.http.routers.apidocker.rule=Host(`api.mozartdigital.docker`)
            - traefik.http.routers.apidocker.entrypoints=websecure
            - traefik.http.routers.apidocker.tls=true
            - traefik.http.services.apidocker.loadbalancer.server.port=80
            - traefik.docker.network=mozart-network
        extra_hosts:
            - "host.docker.internal:host-gateway"
networks:
    api-priv:
    mozart-network:
        external: true
