version: '3'
services:
    webservice:
        build:
            context: .
            dockerfile: ./.docker/nginx.Dockerfile
        depends_on:
            - php
        ports:
            - '8000:80'
        volumes:
            - ./data/storage/public:/app/public/storage

    php:
        build:
            context: .
            dockerfile: ./.docker/php.Dockerfile
        depends_on:
            - db
            - redis
            - socketi
        command: /bin/entrypoint app
        env_file:
            - .app.env
        environment:
            DB_HOST: db
            DB_DATABASE: db
            DB_USERNAME: db
            QUEUE_CONNECTION: redis
            XELATEX_BIN: /usr/bin/xelatex
            PDFLATEX_BIN: /usr/bin/pdflatex
            REDIS_HOST: redis
        volumes:
            - ./data/storage:/app/storage/app
            - ./data/plugins:/app/plugins
            - ./data/cookies:/app/packages/laravel-nami/.cookies

    horizon:
        build:
            context: .
            dockerfile: ./.docker/php.Dockerfile
        depends_on:
            - php
        command: /bin/entrypoint horizon
        env_file:
            - .app.env
        environment:
            DB_HOST: db
            DB_DATABASE: db
            DB_USERNAME: db
            QUEUE_CONNECTION: redis
            XELATEX_BIN: /usr/bin/xelatex
            PDFLATEX_BIN: /usr/bin/pdflatex
            REDIS_HOST: redis
        volumes:
            - ./data/storage:/app/storage/app
            - ./data/plugins:/app/plugins
            - ./data/cookies:/app/packages/laravel-nami/.cookies

    schedule:
        build:
            context: .
            dockerfile: ./.docker/php.Dockerfile
        depends_on:
            - php
        command: /bin/entrypoint schedule
        env_file:
            - .app.env
        environment:
            DB_HOST: db
            DB_DATABASE: db
            DB_USERNAME: db
            QUEUE_CONNECTION: redis
            XELATEX_BIN: /usr/bin/xelatex
            PDFLATEX_BIN: /usr/bin/pdflatex
            REDIS_HOST: redis
        volumes:
            - ./data/storage:/app/storage/app
            - ./data/plugins:/app/plugins
            - ./data/cookies:/app/packages/laravel-nami/.cookies

    db:
        image: mariadb:10.6.5
        env_file:
            - .app.env
        environment:
            MARIADB_RANDOM_ROOT_PASSWORD: yes
            MYSQL_DATABASE: db
            MYSQL_USER: db
        volumes:
            - ./data/db:/var/lib/mysql

    socketi:
        image: quay.io/soketi/soketi:89604f268623cf799573178a7ba56b7491416bde-16-debian
        environment:
            SOKETI_DEFAULT_APP_ID: adremaid
            SOKETI_DEFAULT_APP_KEY: adremakey
            SOKETI_DEFAULT_APP_SECRET: adremasecret

    redis:
        image: redis:alpine3.18
        volumes:
            - ./data/redis:/data

    meilisearch:
        image: getmeili/meilisearch:v1.6
        volumes:
            - ./data/meilisearch:/meili_data
        env_file:
            - .app.env