services:
    db:
        image: mariadb:11.6
        restart: on-failure
        environment:
            - MYSQL_RANDOM_ROOT_PASSWORD=1
            - MYSQL_DATABASE=touchh
            - MYSQL_USER=touchh
            - MYSQL_PASSWORD=${MYSQL_PASSWORD:-touchh}
        volumes:
            - ./var/mysql:/var/lib/mysql
    bot:
        &py_service
        build: .
        image: touchh-py
        restart: on-failure
        command: ['python3', 'manage.py', 'run_bot']
        depends_on: ['db']
        stop_signal: SIGINT
        volumes:
            - .:/app
    scheduler:
        <<: *py_service
        command: ['python3', 'manage.py', 'start_scheduler']
    web:
        <<: *py_service
        command: ['python3', 'manage.py', 'runserver', '0.0.0.0:8000']
        ports:
            - "${DOCKER_HTTP_BIND:-8000}:8000"
