|
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 | | - |
| 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 | + 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 -DBUILD_SHARED_LIBS=OFF && \ |
| 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 |
| 20 | + |
17 | 21 | # ------------------------------ |
18 | 22 | # Stage 2: Setup Python RPC Server |
19 | 23 | # ------------------------------ |
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 | | - |
| 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 . |
| 44 | + |
| 45 | +CMD [ "nice", "-n", "18", "ionice", "-c", "2", "-n", "6", "python3", "-u", "/PythonRpcServer/server.py" ] |
0 commit comments