services:
    drone:
        container_name: drone
        env_file:
            - .env
        image: drone/drone:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.drone.entrypoints: websecure
            traefik.http.routers.drone.rule: Host(`drone.alexlebens.net`)
            traefik.http.routers.drone.service: drone
            traefik.http.services.drone.loadbalancer.server.port: 80
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            drone:
                ipv4_address: 172.22.0.11
            traefik: null
        restart: always
        volumes:
            - drone_data:/data

    drone_runner_1:
        container_name: drone_runner_1
        depends_on: 
            - drone
        env_file:
            - .run.env
        environment:
            DRONE_RUNNER_NAME: drone_runner_1
            DRONE_RUNNER_NETWORKS: traefik
        image: drone/drone-runner-docker:latest
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            drone:
                ipv4_address: 172.22.0.12
        privileged: true
        restart: always
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock

    drone_runner_2:
        container_name: drone_runner_2
        depends_on: 
            - drone
        env_file:
            - .run.env
        environment:
            DRONE_RUNNER_NAME: drone_runner_2
            DRONE_RUNNER_NETWORKS: traefik
        image: drone/drone-runner-docker:latest
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            drone:
                ipv4_address: 172.22.0.13
        privileged: true
        restart: always
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock

networks:
    traefik:
        name: traefik
        external: true

    drone:
        name: drone
        external: false
        ipam:
            config:
                - subnet: 172.22.0.0/16

volumes:
    drone_data:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/drone_data
