version: '3.1'
services:
    redis:
        image: 'redis:alpine'

    mariadb:
        image: 'mariadb:11.0'
        working_dir: /var/www
        volumes:
            - '.:/var/www'
        environment:
            - MYSQL_ROOT_PASSWORD=root
            - MYSQL_DATABASE=badalou
            - MYSQL_USER=badalou
            - MYSQL_PASSWORD=badalou
        ports:
            - '3306:3306'

    webserver:
        image: 'nginx:alpine'
        working_dir: /var/www
        volumes:
            - '.:/var/www'
            - './.docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf'
        ports:
            - '80:80'
        links:
            - php-fpm
        depends_on:
            - php-fpm

    mailpit:
        image: axllent/mailpit
        container_name: mailpit-badalou
        volumes:
            - ./.docker/mailpit/data:/data
        ports:
            - 8025:8025
            - 1025:1025
        environment:
            MP_MAX_MESSAGES: 5000
            MP_DATA_FILE: /data/mailpit.db
            MP_SMTP_AUTH_ACCEPT_ANY: 1
            MP_SMTP_AUTH_ALLOW_INSECURE: 1

    php-fpm:
        build: .docker/php-fpm
        working_dir: /var/www
        environment:
            - XDEBUG_SESSION="VSCODE"
            - PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
            - ASAAS_WEBHOOK_TOKEN="az3H&k@Z##3D9G"
        links:
            - mariadb
            - redis
            - mailpit
        depends_on:
            - mariadb
            - redis
            - mailpit
        ports:
            - '9000:9000'
        volumes:
            - '.:/var/www'
            - './.docker/php-fpm/php-ini-overrides.ini:/etc/php/8.2/fpm/conf.d/99-overrides.ini'
            - './.docker/php-fpm/php-ini-overrides.ini:/etc/php/8.2/cli/conf.d/99-overrides.ini'
