# # Fast Whisper Prepared to Hugging Face Docker! # This file builds a fasst whisper that can run in Hugging Face Docker Space. # HF Docker Space runs under user 1000, due this, some changes is need in build. # # FROM alpine/git as src WORKDIR /src RUN git clone https://github.com/fedirz/faster-whisper-server . FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 RUN apt-get update RUN apt install -y software-properties-common RUN add-apt-repository ppa:deadsnakes/ppa ENV DEBIAN_FRONTEND=noninteractive RUN apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget ca-certificates curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev mecab-ipadic-utf8 git RUN apt-get install -y ffmpeg software-properties-common RUN useradd -m -u 1000 user USER user WORKDIR /pyenv ENV PYENV_ROOT /pyenv/pyenvroot ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH ENV PYTHON_VERSION 3.12 RUN set -ex \ && curl https://pyenv.run | bash \ && pyenv update \ && pyenv install $PYTHON_VERSION \ && pyenv global $PYTHON_VERSION \ && pyenv rehash WORKDIR /server RUN pip install --no-cache-dir --upgrade pip WORKDIR /app COPY --chown=user --from=src /src/requirements.txt . COPY --chown=user --from=src /src/faster_whisper_server ./faster_whisper_server RUN pip install -r requirements.txt RUN pip install uvicorn ENV WHISPER__MODEL=Systran/faster-whisper-small ENV WHISPER__INFERENCE_DEVICE=auto ENV UVICORN_HOST=0.0.0.0 ENV UVICORN_PORT=8000 CMD ["python3.12","-m","uvicorn", "faster_whisper_server.main:app"]