services:
    crm_db:
        image: mariadb:10.5.6
        container_name: crm_db
        restart: unless-stopped
        tty: true
        ports:
            - "3307:3306"
        environment:
            MYSQL_DATABASE: ${DB_DATABASE}
            MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
        volumes:
            - mariadbdata:/var/lib/mysql
            - ./.dockerfile/mysql/my.cnf:/etc/mysql/my.cnf
        networks:
            - crm-network

    crm_phpmyadmin:
        image: phpmyadmin/phpmyadmin:latest
        container_name: crm_phpmyadmin
        depends_on:
            - crm_db
        environment:
            PMA_HOST: crm_db
            MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
        ports:
            - 8889:80
        networks:
            - crm-network

    crm-app:
        build:
            context: .
            dockerfile: Dockerfile
            args:
                user: crm
                uid: 1000
        image: "crm-app"
        container_name: "crm-app"
        restart: unless-stopped
        tty: true
        working_dir: /var/www
        volumes:
            - .:/var/www
            - ./.dockerfile/php/local.ini:/usr/local/etc/php/conf.d/local.ini
        networks:
            - crm-network

    crm-webserver:
        image: nginx:alpine
        container_name: "crm-webserver"
        restart: unless-stopped
        tty: true
        ports:
            - "8200:80"
            - "8443:443"
        volumes:
            - ./:/var/www
            - ./.dockerfile/nginx/conf.d:/etc/nginx/conf.d/
        networks:
            - crm-network

volumes:
    mariadbdata:

networks:
    crm-network:
        driver: bridge
