services:
    php:
        container_name: php_container
        build:
            context: ./docker
            dockerfile: Dockerfile
        image: clipzone/php
        working_dir: /var/www/html
        volumes:
            - ./:/var/www/html
            - ./docker/php.ini:/usr/local/etc/php/php.ini
        networks:
            - application
        depends_on:
            - mariadb
        restart: unless-stopped
    nginx:
        image: nginx:latest
        container_name: nginx_container
        networks:
            - application
        depends_on:
            - mariadb
        ports:
            - "8080:80"
        volumes:
            - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
            - ./:/var/www/html
        links:
            - php
        restart: unless-stopped
    mariadb:
        image: mariadb:latest
        container_name: mariadb_container
        ports:
            - "3306:3306"
        environment:
            MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
            TZ: 'Europe/Paris'
        volumes:
            - ./docker/data/mariadb:/var/lib/mysql
            - ./database/dumps:/dumps
        networks:
            - application
        healthcheck:
            test: [ "CMD", "mysqladmin", "ping" ]
        restart: unless-stopped
    node:
        image: node:18-alpine
        container_name: node_container
        ports:
            - "5173:5173"
        volumes:
            - ./:/usr/src/app
        working_dir: /usr/src/app
        command: npm run dev
        networks:
            - application
    redis:
        image: redis:latest
        container_name: redis_container
        ports:
            - "6379:6379"
        networks:
            - application
        volumes:
            - ./docker/data/redis:/data
    meilisearch:
        image: getmeili/meilisearch:v1.6
        container_name: meilisearch_container
        environment:
            - MEILI_MASTER_KEY=${MEILISEARCH_KEY}
        ports:
            - "7700:7700"
        networks:
            - application
        volumes:
            - ./docker/data/meilisearch:/meili_data
    maildev:
        image: maildev/maildev
        container_name: maildev_container
        command: bin/maildev --web 80 --smtp 25 --hide-extensions STARTTLS
        ports:
            - "1080:80"
            - "25:25"
        networks:
            - application
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        container_name: phpmyadmin_container
        environment:
            PMA_ARBITRARY: 1
            PMA_HOST: mariadb
            PMA_USER: root
        links:
            - mariadb
        ports:
            - "8091:80"
        networks:
            - application
    stripe:
        image: stripe/stripe-cli:latest
        container_name: stripe_container
        command: "listen --api-key ${STRIPE_SECRET} --forward-to nginx/stripe-webhook"
        links:
            - nginx
        networks:
            - application
    minio:
        image: minio/minio:latest
        container_name: minio_container
        ports:
            - "9000:9000"
            - "8900:8900"
        environment:
            MINIO_ROOT_USER: minio
            MINIO_ROOT_PASSWORD: password
        volumes:
            - ./docker/data/minio:/data/minio
        command: 'minio server /data/minio --console-address ":8900"'
        networks:
            - application
    queues:
        container_name: queues_container
        image: clipzone/php
        working_dir: /var/www/html
        command: php artisan horizon
        volumes:
            - ./:/var/www/html
        networks:
            - application
        depends_on:
            - php
        restart: unless-stopped
    websockets:
        image: 'quay.io/soketi/soketi:latest-16-alpine'
        container_name: websockets_container
        environment:
            SOKETI_DEBUG: '1'
            SOKETI_METRICS_SERVER_PORT: '9601'
            SOKETI_DEFAULT_APP_ENABLE_CLIENT_MESSAGES: true
        ports:
            - '6001:6001'
            - '9601:9601'
        networks:
            - application
networks:
    application:
        driver: bridge
