version: '3.9'

services:
  minio:
    container_name: minio
    image: minio/minio:RELEASE.2023-05-04T21-44-30Z
    environment:
      - MINIO_ROOT_USER=${MINIO_ROOT_USER}
      - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
      - MINIO_BROWSER_REDIRECT_URL=${APP_PROTOCOL:-http}://${APP_DOMAIN}
      - MINIO_DOMAIN=Host(`${APP_DOMAIN}`)
    ports:
      - 8000:9000
      - ${APP_PORT}:9001
    restart: unless-stopped
    volumes:
      - ${APP_DATA_DIR}/data/minio/data:/data
    networks:
      - tipi_main_network
    command: "server --console-address :9001 /data"
    labels:
      traefik.enable: ${APP_EXPOSED}
      # Console
      traefik.http.routers.minio-console.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.minio-console.entrypoints: websecure
      traefik.http.routers.minio-console.service: minio-console
      traefik.http.routers.minio-console.tls.certresolver: myresolver
      traefik.http.services.minio-console.loadbalancer.server.port: 9001
      # API
      traefik.http.routers.minio.rule: Host(`${MINIO_API_URL}`)
      traefik.http.routers.minio.entrypoints: websecure
      traefik.http.routers.minio.service: minio
      traefik.http.routers.minio.tls.certresolver: myresolver
      traefik.http.services.minio.loadbalancer.server.port: 9000