-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (46 loc) · 1.73 KB
/
Copy pathDockerfile
File metadata and controls
62 lines (46 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM python:3.11-slim AS llama-builder
ARG LLAMA_CPP_TAG=b7798
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
RUN git clone --depth 1 --branch ${LLAMA_CPP_TAG} https://github.com/ggml-org/llama.cpp.git
WORKDIR /src/llama.cpp
RUN cmake -S . -B build \
-DBUILD_SHARED_LIBS=ON \
-DGGML_VULKAN=OFF \
-DLLAMA_BUILD_TESTS=OFF \
-DLLAMA_BUILD_EXAMPLES=OFF \
-DLLAMA_BUILD_SERVER=OFF \
&& cmake --build build --config Release -j"$(nproc)" \
&& mkdir -p /out \
&& find build -type f \( -name 'libllama.so*' -o -name 'libggml*.so*' \) -exec cp -av {} /out/ \;
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
CW_DATA_DIR=/data \
CW_MODEL_DIR=/app/Fun-ASR-Nano-GGUF \
CW_AUTO_DOWNLOAD_MODEL=0 \
CW_PORT=8000 \
CW_VULKAN_ENABLE=0 \
CW_DML_ENABLE=0 \
LD_LIBRARY_PATH=/app/util/llama/bin:/app/util/fun_asr_gguf/inference/bin
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements-docker.txt /app/requirements-docker.txt
RUN pip install --no-cache-dir -r /app/requirements-docker.txt
COPY . /app
COPY --from=llama-builder /out/ /app/util/llama/bin/
RUN mkdir -p /app/util/fun_asr_gguf/inference/bin \
&& cp -av /app/util/llama/bin/* /app/util/fun_asr_gguf/inference/bin/ \
&& chmod +x /app/scripts/start_api_service.sh \
&& CW_DATA_DIR=/tmp/fun-asr-build-data CW_MODEL_DIR=/app/Fun-ASR-Nano-GGUF CW_AUTO_DOWNLOAD_MODEL=1 python3 scripts/bootstrap_fun_asr_env.py \
&& rm -rf /tmp/fun-asr-build-data
EXPOSE 8000
VOLUME ["/data"]
CMD ["./scripts/start_api_service.sh"]