whisper.cpp / Dockerfile
Arseniy Savin
Enhance Dockerfile and main.py for improved caching and health check endpoint
d7ee472
Raw History Blame Contribute Delete
948 Bytes
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg libgomp1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Ensure cache directories are writable and avoid '/.cache' root path
ENV HOME=/app \
XDG_CACHE_HOME=/app/.cache \
HF_HOME=/app/.cache/huggingface \
CTRANSLATE2_CACHE_DIR=/app/.cache/ctranslate2
RUN mkdir -p "$XDG_CACHE_HOME" "$HF_HOME" "$CTRANSLATE2_CACHE_DIR" \
&& chmod -R 777 /app/.cache
# Python dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
# App source
COPY main.py /app/main.py
# Defaults (overridable at runtime)
ENV WHISPER_MODEL=small \
WHISPER_DEVICE=cpu \
WHISPER_COMPUTE_TYPE=int8 \
WHISPER_BEAM_SIZE=5 \
WHISPER_VAD=false \
WHISPER_WORD_TIMESTAMPS=false
EXPOSE 7860
CMD sh -c "uvicorn main:app --host 0.0.0.0 --port \${PORT:-7860}"