version: '3.5'

services:
    web:
        env_file:
            - .env
        build:
            dockerfile: ./sample-apps/timeline-app/Dockerfile
            context: ../../
        depends_on:
            - db
        command: dockerize -wait-retry-interval 5s -timeout 30s -wait tcp://db:3306 /usr/bin/supervisord
        ports:
            - 8999:80
        environment:
            DB_HOST: db
            DB_NAME: timeline
            DB_USERNAME: timeline
            DB_PASSWORD: timeline
        volumes:
            - ./src:/app/src
            - ./sql:/app/sql
    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: timeline
            MYSQL_USER: timeline
            MYSQL_PASSWORD: timeline
