1- # # ------------------------------
2- # # Stage 1: Build Whisper.cpp
3- # # ------------------------------
1+ # ------------------------------
2+ # Stage 1: Build Whisper.cpp
3+ # ------------------------------
44FROM --platform=linux/amd64 python:3.8.15-slim-buster AS whisperbuild
55RUN apt-get update && \
66 apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg git && \
@@ -12,10 +12,34 @@ RUN apt-get update && \
1212
1313WORKDIR /whisper.cpp
1414RUN git clone https://github.com/ggml-org/whisper.cpp . && \
15- cmake -B build -DWHISPER_BUILD_EXAMPLES=ON && \
15+ cmake -B build -DWHISPER_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=OFF && \
1616 cmake --build build --parallel $(nproc)
1717RUN bash ./models/download-ggml-model.sh base.en
1818RUN bash ./models/download-ggml-model.sh tiny.en
1919RUN bash ./models/download-ggml-model.sh large-v3
2020
21+ # ------------------------------
22+ # Stage 2: Setup Python RPC Server
23+ # ------------------------------
24+ FROM --platform=linux/amd64 python:3.8.15-slim-buster AS rpcserver
25+ RUN apt-get update && \
26+ apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg
27+
28+ ENV OMP_THREAD_LIMIT=1
29+ COPY --from=whisperbuild /whisper.cpp/build/bin/whisper-cli /usr/local/bin/whisper
30+ COPY --from=whisperbuild /whisper.cpp/models /PythonRpcServer/models
31+ WORKDIR /PythonRpcServer
32+
33+ COPY ./PythonRpcServer/transcribe_hellohellohello.wav .
34+ RUN whisper -ojf -f transcribe_hellohellohello.wav
35+
36+ COPY ./PythonRpcServer/requirements.txt requirements.txt
37+ RUN pip install --no-cache-dir --upgrade pip && \
38+ pip install --no-cache-dir -r requirements.txt
39+
40+ COPY ct.proto ct.proto
41+ RUN python -m grpc_tools.protoc -I . --python_out=./ --grpc_python_out=./ ct.proto
42+
43+ COPY ./PythonRpcServer .
2144
45+ CMD [ "nice" , "-n" , "18" , "ionice" , "-c" , "2" , "-n" , "6" , "python3" , "-u" , "/PythonRpcServer/server.py" ]
0 commit comments