name: galera

services:
    mariadb-node1:
        build:
            context: .
            dockerfile: Dockerfile
        networks:
            galera:
        container_name: mariadb-node1
        environment:
            - MARIADB_ROOT_PASSWORD=password
        volumes:
            - ./conf.d:/etc/mysql/conf.d
            - ./ssl:/ssl
            - ./db:/var/lib/mysql

    mariadb-node2:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: mariadb-node2
        networks:
            galera:
        environment:
            - MARIADB_ROOT_PASSWORD=password
            - MARIADB_SLAVE=1
        volumes:
            - ./conf.d:/etc/mysql/conf.d
            - ./ssl:/ssl
            - ./db2:/var/lib/mysql
        command: ["mariadbd"]
        entrypoint: null

    mariadb-node3:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: mariadb-node3
        networks:
            galera:
        environment:
            - MARIADB_ROOT_PASSWORD=password
            - MARIADB_SLAVE=1
        volumes:
            - ./conf.d:/etc/mysql/conf.d
            - ./ssl:/ssl
            - ./db3:/var/lib/mysql
        command: ["mariadbd"]
        entrypoint: null

networks:
    galera:
        driver: bridge
