services:

  thumbnail-server:
    image: ${THUMBNAIL_SERVER_IMAGE:-seafileltd/thumbnail-server:13.0-latest}
    container_name: thumbnail-server
    restart: always
    volumes:
      - ${SEAFILE_VOLUME:-/opt/seafile-data}:/shared
    # ports:
    #   - "80:80"
    environment:
      - TIME_ZONE=${TIME_ZONE:-Etc/UTC}
      - SEAFILE_MYSQL_DB_HOST=${SEAFILE_MYSQL_DB_HOST:-db}
      - SEAFILE_MYSQL_DB_PORT=${SEAFILE_MYSQL_DB_PORT:-3306}
      - SEAFILE_MYSQL_DB_USER=${SEAFILE_MYSQL_DB_USER:-seafile}
      - SEAFILE_MYSQL_DB_PASSWORD=${SEAFILE_MYSQL_DB_PASSWORD:?Variable is not set or empty}
      - SEAFILE_MYSQL_DB_CCNET_DB_NAME=${SEAFILE_MYSQL_DB_CCNET_DB_NAME:-ccnet_db}
      - SEAFILE_MYSQL_DB_SEAFILE_DB_NAME=${SEAFILE_MYSQL_DB_SEAFILE_DB_NAME:-seafile_db}
      - NON_ROOT=${NON_ROOT:-false}
      - JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY:?Variable is not set or empty}
      - SEAFILE_LOG_TO_STDOUT=${SEAFILE_LOG_TO_STDOUT:-false}
      - SITE_ROOT=${SITE_ROOT:-/}
      - INNER_SEAHUB_SERVICE_URL=${INNER_SEAHUB_SERVICE_URL:-http://seafile}
      - THUMBNAIL_IMAGE_ORIGINAL_SIZE_LIMIT=${THUMBNAIL_IMAGE_ORIGINAL_SIZE_LIMIT:-256}
      - SEAF_SERVER_STORAGE_TYPE=${SEAF_SERVER_STORAGE_TYPE:-}
      - S3_COMMIT_BUCKET=${S3_COMMIT_BUCKET:-}
      - S3_FS_BUCKET=${S3_FS_BUCKET:-}
      - S3_BLOCK_BUCKET=${S3_BLOCK_BUCKET:-}
      - S3_KEY_ID=${S3_KEY_ID:-}
      - S3_SECRET_KEY=${S3_SECRET_KEY:-}
      - S3_USE_V4_SIGNATURE=${S3_USE_V4_SIGNATURE:-true}
      - S3_AWS_REGION=${S3_AWS_REGION:-us-east-1}
      - S3_HOST=${S3_HOST:-}
      - S3_USE_HTTPS=${S3_USE_HTTPS:-true}
      - S3_PATH_STYLE_REQUEST=${S3_PATH_STYLE_REQUEST:-false}
      - S3_SSE_C_KEY=${S3_SSE_C_KEY:-}
    labels:
      caddy: ${SEAFILE_SERVER_PROTOCOL:-http}://${SEAFILE_SERVER_HOSTNAME:?Variable is not set or empty}
      caddy.1_handle: "/thumbnail/*"
      caddy.1_handle.0_reverse_proxy: "{{upstreams 80}}"
      caddy.2_handle_path: "/thumbnail/ping"
      caddy.2_handle_path.0_rewrite: "/ping"
      caddy.2_handle_path.1_reverse_proxy: "{{upstreams 80}}"
    depends_on:
      db:
        condition: service_healthy
      seafile:
        condition: service_healthy
    networks:
      - seafile-net

networks:
  seafile-net:
    name: seafile-net
