Block a user
harmonies-worker (0.1)
Published 2026-10-26 05:47:03 +00:00 by stephan
Installation
docker pull gitea.dober.design/stephan/harmonies-worker:0.1sha256:1fa7d96b2b03ba76771f59a579d2bb0e96532c730af01b801e6ef1f2a8ad6cdf
Image Layers
| # debian.sh --arch 'amd64' out/ 'trixie' '@1792531975' |
| ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| RUN /bin/sh -c set -eux; apt-get update; apt-get install -y --no-install-recommends ca-certificates netbase tzdata ; apt-get dist-clean # buildkit |
| ENV GPG_KEY=7169605F62C751356D054A26A821E680E5FA6305 |
| ENV PYTHON_VERSION=3.13.17 |
| ENV PYTHON_SHA256=6020bd10aff3bf4821be16f088ebb1591beb7b811dcd8fab1da8f7c22a7b27e7 |
| RUN /bin/sh -c set -eux; savedAptMark="$(apt-mark showmanual)"; apt-get update; apt-get install -y --no-install-recommends dpkg-dev g++ gcc gnupg libbluetooth-dev libbz2-dev libc6-dev libdb-dev libffi-dev libgdbm-dev liblzma-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev make tk-dev uuid-dev wget xz-utils zlib1g-dev ; wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; echo "$PYTHON_SHA256 *python.tar.xz" | sha256sum -c -; wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; gpg --batch --verify python.tar.xz.asc python.tar.xz; gpgconf --kill all; rm -rf "$GNUPGHOME" python.tar.xz.asc; mkdir -p /usr/src/python; tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; rm python.tar.xz; cd /usr/src/python; gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; ./configure --build="$gnuArch" --enable-loadable-sqlite-extensions --enable-optimizations --enable-option-checking=fatal --enable-shared $(test "${gnuArch%%-*}" != 'riscv64' && echo '--with-lto') --with-ensurepip ; nproc="$(nproc)"; EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; LDFLAGS="${LDFLAGS:-} -Wl,--strip-all"; arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; case "$arch" in amd64|arm64) EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; ;; i386) ;; *) EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer"; ;; esac; make -j "$nproc" "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" "LDFLAGS=${LDFLAGS:-}" ; rm python; make -j "$nproc" "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" "LDFLAGS=${LDFLAGS:-} -Wl,-rpath='\$\$ORIGIN/../lib'" python ; make install; cd /; rm -rf /usr/src/python; find /usr/local -depth \( \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \) -exec rm -rf '{}' + ; ldconfig; apt-mark auto '.*' > /dev/null; apt-mark manual $savedAptMark; find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' | sort -u | xargs -rt dpkg-query --search | awk 'sub(":$", "", $1) { print $1 }' | sort -u | xargs -r apt-mark manual ; apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; apt-get dist-clean; export PYTHONDONTWRITEBYTECODE=1; python3 --version; pip3 --version # buildkit |
| RUN /bin/sh -c set -eux; for src in idle3 pip3 pydoc3 python3 python3-config; do dst="$(echo "$src" | tr -d 3)"; [ -s "/usr/local/bin/$src" ]; [ ! -e "/usr/local/bin/$dst" ]; ln -svT "$src" "/usr/local/bin/$dst"; done # buildkit |
| CMD ["python3"] |
| ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=never UV_PROJECT_ENVIRONMENT=/opt/venv PATH=/opt/venv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin NVIDIA_VISIBLE_DEVICES=all NVIDIA_DRIVER_CAPABILITIES=compute,utility |
| COPY /uv /uvx /usr/local/bin/ # buildkit |
| COPY /ffmpeg /ffprobe /usr/local/bin/ # buildkit |
| RUN /bin/sh -c useradd --system --uid 10001 --user-group --home-dir /home/harmonies --create-home --shell /usr/sbin/nologin harmonies && mkdir -p /models /scratch /data/ytdlp /opt/numba-cache && chown harmonies:harmonies /models /scratch /data /data/ytdlp /opt/numba-cache # buildkit |
| WORKDIR /app |
| COPY pyproject.toml uv.lock README.md ./ # buildkit |
| RUN /bin/sh -c uv sync --frozen --no-dev --no-install-project --extra worker # buildkit |
| RUN /bin/sh -c apt-get update && apt-get install -y --no-install-recommends libatomic1 && rm -rf /var/lib/apt/lists/* # buildkit |
| RUN /bin/sh -c python - <<'EOF' import importlib.metadata as md for name in ("torchvision", "onnx", "onnxruntime"): try: md.distribution(name) except md.PackageNotFoundError: continue raise SystemExit(f"{name} must not be in the worker image") import onnxruntime import torch import torchaudio import pedalboard # noqa: F401 (fails at build time when a system library is missing) cuda = torch.version.cuda if not cuda or not cuda.startswith("13."): raise SystemExit(f"torch is built for CUDA {cuda}, not 13.x") ta_cuda = getattr(getattr(torchaudio, "version", None), "cuda", None) if ta_cuda is not None and ta_cuda != cuda: raise SystemExit(f"torchaudio is built for CUDA {ta_cuda}, torch for {cuda}") if "CUDAExecutionProvider" not in onnxruntime.get_available_providers(): raise SystemExit("onnxruntime has no CUDAExecutionProvider") print(f"torch {torch.__version__} (CUDA {cuda}), torchaudio {torchaudio.__version__}, onnxruntime {onnxruntime.__version__}") EOF # buildkit |
| ENV NUMBA_CACHE_DIR=/opt/numba-cache |
| RUN /bin/sh -c python - <<'EOF' && chown -R harmonies:harmonies /opt/numba-cache import numpy as np import librosa sr = 22050 y = (0.1 * np.sin(2 * np.pi * 220 * np.arange(sr * 2) / sr)).astype(np.float32) calls = { "stft/istft": lambda: librosa.istft(librosa.stft(y)), "hpss": lambda: librosa.effects.hpss(y, margin=(1.0, 3.0)), "estimate_tuning": lambda: librosa.estimate_tuning(y=y, sr=sr, bins_per_octave=12), "cqt/chroma_cqt": lambda: librosa.feature.chroma_cqt(C=np.abs(librosa.cqt(y, sr=sr)), sr=sr), "rms": lambda: librosa.feature.rms(y=y), "mel": lambda: librosa.filters.mel(sr=44100, n_fft=2048, n_mels=128), "onset/localmax": lambda: librosa.onset.onset_detect(y=y, sr=sr), "yin": lambda: librosa.yin(y, fmin=65, fmax=1000, sr=sr), } for name, call in calls.items(): try: call() except Exception as e: # a renamed function must not break the build; it only costs a compile later print(f"numba warm-up: {name} skipped ({e})") print("numba warm-up done") EOF # buildkit |
| COPY src/ src/ # buildkit |
| RUN /bin/sh -c uv sync --frozen --no-dev --extra worker && python -c "import harmonies.cli, harmonies.core.render" # buildkit |
| COPY --chmod=755 <<EOF /usr/local/bin/worker-entrypoint # buildkit |
| ENV HARMONIES_ROLE=pull HF_HUB_OFFLINE=1 HOME=/home/harmonies UV_CACHE_DIR=/tmp/uv-cache HARMONIES_YTDLP_DIR=/data/ytdlp |
| USER harmonies |
| ENTRYPOINT ["/usr/local/bin/worker-entrypoint"] |
| CMD ["harmonies" "worker" "pull"] |
Labels
| Key | Value |
|---|---|
| org.opencontainers.image.created | 2026-10-26T05:42:55.028Z |
| org.opencontainers.image.description | |
| org.opencontainers.image.licenses | |
| org.opencontainers.image.revision | 702677e4da43e569d94263d0f61d23cd01bc2488 |
| org.opencontainers.image.source | http://gitea-http.gitea.svc.cluster.local:3000/stephan/harmonies |
| org.opencontainers.image.title | harmonies |
| org.opencontainers.image.url | http://gitea-http.gitea.svc.cluster.local:3000/stephan/harmonies |
| org.opencontainers.image.version | 0.1.0 |
Details
2026-10-26 05:47:03 +00:00
Versions (7)
View all
Container
2
OCI / Docker
linux/amd64
3.3 GiB