services:
    minio:
        command: -c 'minio server /data --console-address ":9001"'
        container_name: minio_server
        deploy:
            restart_policy:
                condition: on-failure
        entrypoint: sh
        env_file: 
            - .env
        healthcheck:
            test:
                [
                    "CMD",
                    "curl",
                    "-f",
                    "http://localhost:9000/minio/health/live"
                ]
            interval: 30s
            timeout: 20s
            retries: 3
        image: minio/minio:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.minio.entrypoints: websecure
            traefik.http.routers.minio.rule: Host(`minio.alexlebens.net`)
            traefik.http.routers.minio.service: minio
            traefik.http.services.minio.loadbalancer.server.port: 9000
            traefik.http.routers.minio-console.entrypoints: websecure
            traefik.http.routers.minio-console.rule: Host(`minioconsole.alexlebens.net`)
            traefik.http.routers.minio-console.service: minio-console
            traefik.http.services.minio-console.loadbalancer.server.port: 9001
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: unless-stopped
        privileged: true
        volumes:
            - storage:/data

networks:
    traefik:
        name: traefik
        external: true

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