forked from opendatahub-io/ogx-distribution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
41 lines (33 loc) · 1.29 KB
/
Copy pathContainerfile
File metadata and controls
41 lines (33 loc) · 1.29 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
# Use the pre-built vLLM CPU image for OpenAI-compatible serving.
#
# Reference: https://hub.docker.com/r/vllm/vllm-openai-cpu
FROM vllm/vllm-openai-cpu:v0.25.0
RUN pip install "huggingface-hub[cli]"
# Model configuration
ARG INFERENCE_MODEL=""
ARG EMBEDDING_MODEL=""
ENV INFERENCE_MODEL="${INFERENCE_MODEL}"
ENV EMBEDDING_MODEL="${EMBEDDING_MODEL}"
ENV MODEL_CACHE_DIR="/opt/vllm/models"
RUN if [ -z "${INFERENCE_MODEL}" ]; then \
echo "ERROR: INFERENCE_MODEL build argument is required" >&2 && exit 1; \
fi && \
if [ -z "${EMBEDDING_MODEL}" ]; then \
echo "ERROR: EMBEDDING_MODEL build argument is required" >&2 && exit 1; \
fi
RUN --mount=type=secret,id=hf_token \
set -e && \
for model in "${INFERENCE_MODEL}" "${EMBEDDING_MODEL}"; do \
model_path="${MODEL_CACHE_DIR}/${model}" && \
mkdir -p "${model_path}" && \
if [ -f /run/secrets/hf_token ]; then \
HF_TOKEN=$(cat /run/secrets/hf_token) && \
hf download "${model}" --local-dir "${model_path}" --token "${HF_TOKEN}"; \
else \
hf download "${model}" --local-dir "${model_path}"; \
fi && \
rm -rf "${MODEL_CACHE_DIR}/.huggingface" "${model_path}/original"; \
done
RUN useradd -r -u 1001 -m vllm
USER 1001
ENTRYPOINT ["vllm", "serve"]