Improve cpu and gpu Dockerfiles, resulting in much smaller images

This commit is contained in:
Andreas Peldszus
2024-04-26 15:51:11 +02:00
parent 0dfbdb2477
commit dccfce2a3c
2 changed files with 27 additions and 33 deletions
+13 -12
View File
@@ -1,22 +1,23 @@
FROM python:3.8-slim-buster
FROM python:3.10-bookworm
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
sudo \
git \
bzip2 \
libx11-6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# install lib required for pyaudio
RUN apt update && apt install -y portaudio19-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
# update pip to support for whl.metadata -> less downloading
RUN pip install --no-cache-dir -U "pip>=24"
# create a working directory
RUN mkdir /app
WORKDIR /app
COPY scripts/setup.sh requirements/server.txt /app/
# install pytorch, but without the nvidia-libs that are only necessary for gpu
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
RUN apt update && bash setup.sh && pip install -r server.txt
# install the requirements for running the whisper-live server
COPY requirements/server.txt /app/
RUN pip install --no-cache-dir -r server.txt && rm server.txt
COPY whisper_live /app/whisper_live
COPY run_server.py /app