version: '3'

services:
    web:
        image: nginx:latest
        ports:
            - "80:80"
        volumes:
            - ./webroot:/webroot:ro
            - ./resources/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
            - ./resources/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
            - ./log/nginx:/var/log/nginx
        networks:
          - backend
        restart: always

    php:
        build: ./php/
        volumes:
            - ./webroot:/webroot:ro
            - ./resources/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini:ro
        networks:
          - backend
        restart: always

    database:
        image: mariadb:latest
        volumes:
            - ./log/mariadb:/var/log/mysql
            - ./resources/mariadb/base.sql:/docker-entrypoint-initdb.d/init.sql:ro
            - ./resources/mariadb/custom.cnf:/etc/mysql/conf.d/custom.cnf:ro
        environment:
            MYSQL_RANDOM_ROOT_PASSWORD: "yes"
        networks:
          - backend
        restart: always

    debian:
        build: ./debian-ssh/
        ports:
            - "2077:22"
        restart: always

networks:
    backend:
        driver: bridge
