Hugging Face Hub CLI for Swale workflows. Backs the hf-download and hf-upload tasks.
984
Swale-built image backing the hf-download and hf-upload task definitions. It
wraps the Hugging Face CLI (hf)
so a workflow can pull models/datasets into the shared workspace or push
artifacts back to the Hub.
python:3.13-slimhuggingface_hub[cli,hf_xet] (the hf CLI plus the Xet
accelerated transfer backend), at the version pinned in
requirements.txtswale (uid 1000)INPUT_CACHE_DIR relocates it: a workspace path keeps the staged blobs for
later downloads in the same run and keeps the staging copy off task scratch.WORKDIR /mnt/workspace, ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]The task definition's exec.args are appended to the entrypoint as the hf
command line, e.g. ["download", "${{inputs.repo}}", "--local-dir", "${{inputs.dest}}"]. The entrypoint then augments that command line from these
inputs before running hf "$@":
| Input env | Applies to | Effect |
|---|---|---|
INPUT_INCLUDE | download | Comma-separated glob patterns; each becomes a repeated --include <glob>. Patterns are passed literally (no shell globbing). |
INPUT_REVISION | all | Appended as --revision <ref> to pin a branch, tag, or commit. |
INPUT_CACHE_DIR | all | Exported as HF_HOME when non-empty, moving the Hub cache off the per-task home directory. |
INPUT_DEST | download | The full local path the caller chose for the download; emitted verbatim as the path output. |
INPUT_PATH_IN_REPO | upload | Appended as the trailing positional destination path inside the target repository. |
After a successful download, the entrypoint appends
path=<dest>
to $WORKFLOW_TASK_OUTPUT, where <dest> is the full path from INPUT_DEST
(the caller-supplied, required dest input). The consuming task must declare a
path output. upload emits nothing.
Each tag is the version of the Hugging Face Hub client (huggingface_hub) the image packages, such as 1.29.0. A
rebuild that keeps that version, to pick up a fixed base image or wrapper,
adds -r1, -r2, and so on. A tag is never reused; latest follows the
newest publish.
From the repository root:
docker build -t swaleio/hf-cli:dev images/hf-cli
Merging a change under images/hf-cli publishes the image under its next tag;
task definitions reference it by digest.
Built from images/hf-cli in the
swaleio/task-definitions repository. For how a task definition
references an image, see the
task definition reference
in the Swale documentation.
The Dockerfile and entrypoint are covered by the MIT License. The Hugging Face CLI is Apache-2.0-licensed.
This image also contains software from other projects, each under its own
license. The license texts those projects ship are inside the image:
/usr/share/doc/<package>/copyright for Debian packages,
/usr/local/lib/python3.13/LICENSE.txt for Python itself and the *.dist-info
directory of each Python package. Source code for its GPL and LGPL components:
https://snapshot.debian.org/package/<source-package>/<version>/https://pypi.org/project/<name>/<version>/#filesWe also provide that source code on request: see Third-party software.
docker pull swaleio/hf-cli:latest