Skip to content

Commit 0578a22

Browse files
committed
stage 1 build whisper.cpp finished, cmake added
1 parent fff23ad commit 0578a22

File tree

2 files changed

+63
-44
lines changed

2 files changed

+63
-44
lines changed

pythonrpcserver.Dockerfile

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,19 @@
11
# # ------------------------------
22
# # Stage 1: Build Whisper.cpp
33
# # ------------------------------
4-
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS whisperbuild
5-
RUN apt-get update && \
6-
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg git
7-
8-
WORKDIR /whisper.cpp
9-
# RUN git clone https://github.com/ggerganov/whisper.cpp . && make
10-
RUN git clone https://github.com/ggerganov/whisper.cpp . && \
11-
git checkout 021eef1 && \
12-
make
13-
RUN bash ./models/download-ggml-model.sh base.en
14-
RUN bash ./models/download-ggml-model.sh tiny.en
15-
RUN bash ./models/download-ggml-model.sh large-v3
16-
17-
# ------------------------------
18-
# Stage 2: Setup Python RPC Server
19-
# ------------------------------
20-
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS rpcserver
21-
RUN apt-get update && \
22-
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg
23-
24-
ENV OMP_THREAD_LIMIT=1
25-
COPY --from=whisperbuild /whisper.cpp/main /usr/local/bin/whisper
26-
COPY --from=whisperbuild /whisper.cpp/models /PythonRpcServer/models
27-
WORKDIR /PythonRpcServer
28-
29-
# Don't copy any py files here, so that we don't need to re-run whisper
30-
COPY ./PythonRpcServer/transcribe_hellohellohello.wav .
31-
# The output of tis whisper run is used when we set MOCK_RECOGNITION=MOCK for quick testing
32-
RUN whisper -ojf -f transcribe_hellohellohello.wav
33-
34-
COPY ./PythonRpcServer/requirements.txt requirements.txt
35-
RUN pip install --no-cache-dir --upgrade pip && \
36-
pip install --no-cache-dir -r requirements.txt
37-
38-
COPY ct.proto ct.proto
39-
RUN python -m grpc_tools.protoc -I . --python_out=./ --grpc_python_out=./ ct.proto
40-
41-
COPY ./PythonRpcServer .
42-
43-
44-
CMD [ "nice", "-n", "18", "ionice", "-c", "2", "-n", "6", "python3", "-u", "/PythonRpcServer/server.py" ]
45-
46-
47-
4+
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS whisperbuild
5+
RUN apt-get update && \
6+
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg git && \
7+
apt-get install -y wget && \
8+
wget https://github.com/Kitware/CMake/releases/download/v3.27.7/cmake-3.27.7-linux-x86_64.sh -O /tmp/cmake-install.sh && \
9+
chmod +x /tmp/cmake-install.sh && \
10+
/tmp/cmake-install.sh --skip-license --prefix=/usr/local && \
11+
rm /tmp/cmake-install.sh
12+
13+
WORKDIR /whisper.cpp
14+
RUN git clone https://github.com/ggml-org/whisper.cpp . && \
15+
cmake -B build -DWHISPER_BUILD_EXAMPLES=ON && \
16+
cmake --build build --parallel $(nproc)
17+
RUN bash ./models/download-ggml-model.sh base.en
18+
RUN bash ./models/download-ggml-model.sh tiny.en
19+
RUN bash ./models/download-ggml-model.sh large-v3

pythonrpcserver_legacy.Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# # ------------------------------
2+
# # Stage 1: Build Whisper.cpp
3+
# # ------------------------------
4+
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS whisperbuild
5+
RUN apt-get update && \
6+
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg git
7+
8+
WORKDIR /whisper.cpp
9+
# RUN git clone https://github.com/ggerganov/whisper.cpp . && make
10+
RUN git clone https://github.com/ggerganov/whisper.cpp . && \
11+
git checkout 021eef1 && \
12+
make
13+
RUN bash ./models/download-ggml-model.sh base.en
14+
RUN bash ./models/download-ggml-model.sh tiny.en
15+
RUN bash ./models/download-ggml-model.sh large-v3
16+
17+
# ------------------------------
18+
# Stage 2: Setup Python RPC Server
19+
# ------------------------------
20+
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS rpcserver
21+
RUN apt-get update && \
22+
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg
23+
24+
ENV OMP_THREAD_LIMIT=1
25+
COPY --from=whisperbuild /whisper.cpp/main /usr/local/bin/whisper
26+
COPY --from=whisperbuild /whisper.cpp/models /PythonRpcServer/models
27+
WORKDIR /PythonRpcServer
28+
29+
# Don't copy any py files here, so that we don't need to re-run whisper
30+
COPY ./PythonRpcServer/transcribe_hellohellohello.wav .
31+
# The output of tis whisper run is used when we set MOCK_RECOGNITION=MOCK for quick testing
32+
RUN whisper -ojf -f transcribe_hellohellohello.wav
33+
34+
COPY ./PythonRpcServer/requirements.txt requirements.txt
35+
RUN pip install --no-cache-dir --upgrade pip && \
36+
pip install --no-cache-dir -r requirements.txt
37+
38+
COPY ct.proto ct.proto
39+
RUN python -m grpc_tools.protoc -I . --python_out=./ --grpc_python_out=./ ct.proto
40+
41+
COPY ./PythonRpcServer .
42+
43+
44+
CMD [ "nice", "-n", "18", "ionice", "-c", "2", "-n", "6", "python3", "-u", "/PythonRpcServer/server.py" ]
45+
46+
47+

0 commit comments

Comments
 (0)