speech-to-text / Dockerfile
rbcurzon's picture
Update Dockerfile
a564817 verified
raw
history blame
1.12 kB
FROM python:3.11-slim-bookworm
RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends gcc g++ && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --upgrade -r /code/requirements.txt && \
pip install --no-cache-dir --upgrade setuptools wheel && \
pip install git+https://github.com/huggingface/transformers.git && \
apt-get purge -y --auto-remove gcc g++ && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
RUN pip install --no-cache-dir --upgrade pip
USER root
RUN apt-get update && apt-get install -y ffmpeg
COPY --chown=user . $HOME/app
RUN git config --global --add safe.directory /home/user/app
RUN --mount=type=secret,id=GENAI_API_KEY,mode=0444,required=true
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4"]