version: '3.5'

services:
    web:
        container_name: php-retry-middleware-app-web
        env_file:
            - .env
        command: dockerize -wait-retry-interval 3s -timeout 30s -wait tcp://db:3306 /usr/bin/supervisord
        depends_on:
            - db
        build:
            dockerfile: ./sample-apps/retry-middleware-app/Dockerfile
            context: ../../
        ports:
            - 8999:80
        environment:
            DB_HOST: db
            DB_NAME: retrymiddleware
            DB_USERNAME: user
            DB_PASSWORD: password
        volumes:
            - ./src:/app/src
            - ./sql:/app/sql
    db:
        container_name: php-retry-middleware-app-db
        image: mysql:8.0
        command: mysqld --default-authentication-plugin=mysql_native_password
        volumes:
            - ./db/mysql:/var/lib/mysql
        ports:
            - 3306:3306
        logging:
            driver: none
        environment:
            MYSQL_ROOT_PASSWORD: root
            MYSQL_DATABASE: retrymiddleware
            MYSQL_USER: user
            MYSQL_PASSWORD: password
