Merge pull request #206 from peldszus/smaller-dockerimages
Improve cpu and gpu Dockerfiles, resulting in much smaller images
This commit is contained in:
+13
-12
@@ -1,22 +1,23 @@
|
|||||||
FROM python:3.8-slim-buster
|
FROM python:3.10-bookworm
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
# install lib required for pyaudio
|
||||||
curl \
|
RUN apt update && apt install -y portaudio19-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
ca-certificates \
|
|
||||||
sudo \
|
|
||||||
git \
|
|
||||||
bzip2 \
|
|
||||||
libx11-6 \
|
|
||||||
&& 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
|
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 whisper_live /app/whisper_live
|
||||||
COPY run_server.py /app
|
COPY run_server.py /app
|
||||||
|
|||||||
+14
-21
@@ -1,33 +1,26 @@
|
|||||||
FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04
|
FROM python:3.10-bookworm
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Remove any third-party apt sources to avoid issues with expiring keys.
|
# install lib required for pyaudio
|
||||||
RUN rm -f /etc/apt/sources.list.d/*.list
|
RUN apt update && apt install -y portaudio19-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install some basic utilities.
|
# update pip to support for whl.metadata -> less downloading
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN pip install --no-cache-dir -U "pip>=24"
|
||||||
curl \
|
|
||||||
ca-certificates \
|
|
||||||
sudo \
|
|
||||||
git \
|
|
||||||
bzip2 \
|
|
||||||
libx11-6 \
|
|
||||||
python3-dev \
|
|
||||||
python3-pip \
|
|
||||||
&& python3 -m pip install --upgrade pip \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Create a working directory.
|
# create a working directory
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY scripts/setup.sh requirements/server.txt /app
|
# 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
|
||||||
|
|
||||||
RUN apt update && bash setup.sh && rm setup.sh
|
# make the paths of the nvidia libs installed as wheels visible. equivalent to:
|
||||||
RUN pip install -r server.txt && rm server.txt
|
# export LD_LIBRARY_PATH=`python3 -c 'import os; import nvidia.cublas.lib; import nvidia.cudnn.lib; print(os.path.dirname(nvidia.cublas.lib.__file__) + ":" + os.path.dirname(nvidia.cudnn.lib.__file__))'`
|
||||||
|
ENV LD_LIBRARY_PATH="/usr/local/lib/python3.10/site-packages/nvidia/cublas/lib:/usr/local/lib/python3.10/site-packages/nvidia/cudnn/lib"
|
||||||
|
|
||||||
COPY whisper_live /app/whisper_live
|
COPY whisper_live /app/whisper_live
|
||||||
|
|
||||||
COPY run_server.py /app
|
COPY run_server.py /app
|
||||||
|
|
||||||
CMD ["python3", "run_server.py"]
|
CMD ["python", "run_server.py"]
|
||||||
|
|||||||
Reference in New Issue
Block a user