Skip to content

Commit 2fe4720

Browse files
committed
stage 2 finished too, set up python rpc server with cmake ver. whisper
1 parent 19cd9db commit 2fe4720

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

pythonrpcserver.Dockerfile

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# # ------------------------------
2-
# # Stage 1: Build Whisper.cpp
3-
# # ------------------------------
1+
# ------------------------------
2+
# Stage 1: Build Whisper.cpp
3+
# ------------------------------
44
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS whisperbuild
55
RUN 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

1313
WORKDIR /whisper.cpp
1414
RUN 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)
1717
RUN bash ./models/download-ggml-model.sh base.en
1818
RUN bash ./models/download-ggml-model.sh tiny.en
1919
RUN 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

Comments
 (0)