name: wolfgang
services:
    wolfgang-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: [ wolfgang-priv, mozart-network ]
        extra_hosts:
            - "host.docker.internal:host-gateway"
    nginx:
        image: nginx:alpine
        depends_on: [ wolfgang-php ]
        environment:
            SERVER_NAME: ${SERVER_NAME}
        volumes:
            - ${DOCUMENT_ROOT:-./www}:/var/www/html:ro
            - ./config/nginx/conf.d:/etc/nginx/conf.d:ro
        networks: [ wolfgang-priv, mozart-network ]
        expose:
            - "80"
        labels:
            - traefik.enable=true
            - traefik.http.routers.wolfgang.rule=Host(`${SERVER_NAME}`)
            - traefik.http.routers.wolfgang.entrypoints=websecure
            - traefik.http.routers.wolfgang.tls=true
            - traefik.http.services.wolfgang.loadbalancer.server.port=80
            - traefik.docker.network=mozart-network
        extra_hosts:
            - "host.docker.internal:host-gateway"
    node-builder:
        image: node:20-alpine
        working_dir: /var/www/html
        volumes:
            - '.:/var/www/html'
        command: sh -c "npm ci && npx vite --host"
        environment:
            SERVER_NAME_VITE: ${SERVER_NAME}
        ports:
            - "5173:5173"
        networks: [ wolfgang-priv, mozart-network ]
        labels:
            - traefik.enable=true
            - traefik.http.routers.wolfgang-vite.rule=Host(`${SERVER_NAME}`)
            - traefik.http.services.wolfgang-vite.loadbalancer.server.port=5173
            - traefik.docker.network=mozart-network
networks:
    wolfgang-priv:
    mozart-network:
        external: true

