version: '3.9'

services:
    server:
        build:
            context: .
            dockerfile: ./Dockerfile
        container_name: 'stella-booking'
        ports:
            - '80:80'
            - '443:443'
        working_dir: /var/www/html
        volumes:
            - ./symfony:/var/www/html
            - ./docker/php/php.ini:/usr/local/etc/php/conf.d/extra-php-config.ini
        depends_on:
            mariadb:
                condition: service_healthy
        networks:
          - stella_booking_network

    mariadb:
        image: mariadb:10.5.9
        restart: always
        networks:
            - stella_booking_network
        volumes:
            - stella_booking_db_data:/var/lib/mysql
        environment:
            - MYSQL_DATABASE=root
            - MYSQL_ROOT_PASSWORD=root
        healthcheck:
            test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD
            interval: 5s
            retries: 4

    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        restart: always
        networks:
            - stella_booking_network
        links:
            - mariadb:mariadb
        ports:
            - 8081:80
        depends_on:
            - mariadb
        environment:
            - PMA_HOST=mariadb
            - PMA_USER=root
            - PMA_PASSWORD=root
            - UPLOAD_LIMIT=200M

    mailcatcher:
        container_name: stella_booking_mailcatcher
        image: schickling/mailcatcher
        ports:
            - 1025:1025
            - 1080:1080
        networks:
            - stella_booking_network

volumes:
  stella_booking_db_data:

networks:
  stella_booking_network:
