-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile.vllm
More file actions
97 lines (81 loc) · 4.56 KB
/
Copy pathDockerfile.vllm
File metadata and controls
97 lines (81 loc) · 4.56 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# =============================================================================
# NVFlow vLLM Container
# =============================================================================
# vLLM inference container: adds SAM 3.1 and pre-caches tokenizer encodings so
# it serves airgapped. VLLM_VERSION selects the base tag -- both vLLM images
# build from this file and ship in the nvflow-vllm repo under different tags.
#
# Builds below are single-arch (host platform); see docker_instructions.md for
# multi-arch.
#
# Build (SDG / eval):
# docker build -f dockerfiles/Dockerfile.vllm -t nvflow-vllm:v0.22.0 .
#
# Build (GRPO rollouts + judge; matches NeMo-RL v0.7.0's colocated vLLM):
# docker build --build-arg VLLM_VERSION=v0.20.0 \
# -f dockerfiles/Dockerfile.vllm -t nvflow-vllm:v0.20.0 .
#
# Upstream source:
# https://github.com/NVIDIA-NeMo/Skills/blob/main/dockerfiles/Dockerfile.vllm
# =============================================================================
ARG VLLM_VERSION=v0.22.0
FROM scratch AS sam3-src
ARG SAM3_COMMIT=a51b9f498c84824a94702cc289ed75d9cc544c64
ADD --keep-git-dir=true https://github.com/facebookresearch/sam3.git#${SAM3_COMMIT} /
# ===========================================================================
# BEGIN UPSTREAM (NeMo-Skills Dockerfile.vllm)
# ===========================================================================
FROM vllm/vllm-openai:${VLLM_VERSION}
RUN pip install ray
RUN pip install "vllm[audio]"
# Required by vLLM for Qwen-VL model family (runtime dependency, not directly imported)
RUN pip install qwen-vl-utils
# ===========================================================================
# END UPSTREAM
# ===========================================================================
# ===========================================================================
# NVFlow Additional Layers
# ===========================================================================
# Add SAM 3.1 without disturbing vLLM's tested Torch/NumPy stack: install only
# its missing deps + source with --no-deps (SAM's numpy<2 pin would downgrade).
# ===========================================================================
COPY --from=sam3-src / /opt/sam3
RUN pip install --no-cache-dir --no-deps \
ftfy==6.1.1 \
iopath==0.1.10 \
portalocker==3.2.0 \
pycocotools==2.0.11 \
wcwidth==0.2.14 && \
pip install --no-cache-dir --no-deps --no-build-isolation -e /opt/sam3 && \
rm -rf /opt/sam3/.git
# `vllm[audio]` and `ray` above are unpinned; assert the base tag's vLLM version
# survived. Ray is only reported -- these servers run standalone.
ARG VLLM_VERSION
RUN python3 -c "import numpy, sam3, torch, vllm, ray; \
from sam3.model_builder import build_sam3_image_model; \
assert vllm.__version__.startswith('${VLLM_VERSION#v}'), f'vllm {vllm.__version__} != ${VLLM_VERSION#v}'; \
print(f'SAM 3.1 + vLLM imports OK: numpy={numpy.__version__}, torch={torch.__version__}, vllm={vllm.__version__}, ray={ray.__version__}')"
# Pre-cache tokenizer encodings so no downloads are needed at runtime.
ENV TIKTOKEN_CACHE_DIR=/opt/tiktoken_cache
ENV TIKTOKEN_RS_CACHE_DIR=/opt/tiktoken_cache
ENV TIKTOKEN_ENCODINGS_BASE=/opt/tiktoken_cache
RUN mkdir -p /opt/tiktoken_cache
# Fetch tiktoken encodings explicitly -- the Rust tiktoken-rs client in
# openai_harmony fails to download under QEMU arm64. Keeps the image airgapped.
RUN curl -fSL -o /opt/tiktoken_cache/o200k_base.tiktoken \
https://openaipublic.blob.core.windows.net/encodings/o200k_base.tiktoken && \
curl -fSL -o /opt/tiktoken_cache/cl100k_base.tiktoken \
https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken
# Verify the harmony encoding loads from the pre-downloaded files
RUN python3 -c "\
from openai_harmony import load_harmony_encoding, HarmonyEncodingName; \
load_harmony_encoding(HarmonyEncodingName.HARMONY_GPT_OSS); \
print('openai_harmony encoding loaded OK')"
# ===========================================================================
# Security hardening (Trivy/NSPECT wave scans, 2026-07-07)
# ===========================================================================
# apt upgrade for base-channel security fixes (linux-libc-dev/gnupg/openssl = 227 of 233 HIGH/CRIT Trivy); headers stay INSTALLED for vLLM triton JIT
RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
# rm ray_dist.jar: jackson-databind RCE CVE-2026-54512/CVE-2026-54513 (Ray-Java unused); fail build if one survives
RUN find /usr/local /opt -name 'ray_dist.jar' -type f -delete 2>/dev/null; \
! find /usr/local /opt -name 'ray_dist.jar' -type f 2>/dev/null | grep -q .