Preload server-side models.

This commit is contained in:
Lucas Winther
2026-07-14 21:51:42 +02:00
parent ce189b2967
commit cba27fc728
+7 -3
View File
@@ -77,12 +77,16 @@ RUN python3 -m venv /opt/faster-whisper \
&& /opt/faster-whisper/bin/pip install --no-cache-dir -r server-py/requirements.txt
ENV SIDECAR_PYTHON=/opt/faster-whisper/bin/python3
# Cache Whisper weights inside the data volume so a container restart does not
# re-download them (first request per model downloads from the HF Hub).
ENV FASTER_WHISPER_DOWNLOAD_ROOT=/app/data/faster-whisper-models
# Cache Whisper weights inside the image (outside the /app/data volume)
# so they are not shadowed by bind mounts and don't need to be downloaded at runtime.
ENV FASTER_WHISPER_DOWNLOAD_ROOT=/opt/faster-whisper/models
RUN mkdir -p /opt/faster-whisper/models && chown -R bun:bun /opt/faster-whisper/models
USER bun
# Pre-download the allowed models (large-v3-turbo and medium.en)
RUN $SIDECAR_PYTHON -c "import faster_whisper; faster_whisper.download_model('large-v3-turbo', cache_dir='/opt/faster-whisper/models'); faster_whisper.download_model('medium.en', cache_dir='/opt/faster-whisper/models')"
# ---------------------------------------------------------------------------
# Default target: a plain `docker build .` (what .gitlab-ci.yml runs) must
# produce the Bun-only image, but Docker builds the *last* stage by default