version: '3'

services:
    web:
        image: nginx:latest
        ports:
            - "8080:80"
        volumes:
            - ./webroot:/webroot
            - ./resources/nginx/default.conf:/etc/nginx/conf.d/default.conf
            - ./resources/nginx/nginx.conf:/etc/nginx/nginx.conf
            - ./log/nginx:/var/log/nginx
        links:
            - php
        restart: always

    php:
        build: ./php/
        volumes:
            - ./webroot:/webroot
            - ./resources/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
        links:
            - database
        restart: always

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

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