Skip to content

Commit 4d3866a

Browse files
committed
Update base image and dependencies including optimum
Pin some python subdependencies to avoid reported CVEs Signed-off-by: Nick Hill <[email protected]>
1 parent 3ef106e commit 4d3866a

File tree

7 files changed

+1262
-82
lines changed

7 files changed

+1262
-82
lines changed

Dockerfile

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
## Global Args #################################################################
2-
ARG BASE_UBI_IMAGE_TAG=9.2-696
3-
ARG PROTOC_VERSION=23.4
2+
ARG BASE_UBI_IMAGE_TAG=9.2-722
3+
ARG PROTOC_VERSION=24.0
44
#ARG PYTORCH_INDEX="https://download.pytorch.org/whl/nightly"
55
ARG PYTORCH_INDEX="https://download.pytorch.org/whl"
66
ARG PYTORCH_VERSION=2.0.1
7-
ARG OPTIMUM_VERSION=1.9.1
87

98
## Base Layer ##################################################################
109
FROM registry.access.redhat.com/ubi9/ubi:${BASE_UBI_IMAGE_TAG} as base
1110
WORKDIR /app
1211

13-
RUN dnf install -y --disableplugin=subscription-manager \
14-
make \
15-
# to help with debugging
16-
procps \
17-
&& dnf clean all --disableplugin=subscription-manager
12+
RUN dnf remove -y --disableplugin=subscription-manager \
13+
subscription-manager \
14+
# we install newer version of requests via pip
15+
python3-requests \
16+
&& dnf install -y make \
17+
# to help with debugging
18+
procps \
19+
&& dnf clean all
1820

1921
ENV LANG=C.UTF-8 \
2022
LC_ALL=C.UTF-8
@@ -29,14 +31,14 @@ ENV CUDA_VERSION=11.8.0 \
2931
NV_CUDA_CUDART_VERSION=11.8.89-1 \
3032
NV_CUDA_COMPAT_VERSION=520.61.05-1
3133

32-
RUN dnf config-manager --disableplugin=subscription-manager \
34+
RUN dnf config-manager \
3335
--add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo \
34-
&& dnf install -y --disableplugin=subscription-manager \
36+
&& dnf install -y \
3537
cuda-cudart-11-8-${NV_CUDA_CUDART_VERSION} \
3638
cuda-compat-11-8-${NV_CUDA_COMPAT_VERSION} \
3739
&& echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf \
3840
&& echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf \
39-
&& dnf clean all --disableplugin=subscription-manager
41+
&& dnf clean all
4042

4143
ENV CUDA_HOME="/usr/local/cuda" \
4244
PATH="/usr/local/nvidia/bin:${CUDA_HOME}/bin:${PATH}" \
@@ -50,15 +52,15 @@ ENV NV_NVTX_VERSION=11.8.86-1 \
5052
NV_LIBCUBLAS_VERSION=11.11.3.6-1 \
5153
NV_LIBNCCL_PACKAGE_VERSION=2.15.5-1+cuda11.8
5254

53-
RUN dnf config-manager --disableplugin=subscription-manager \
55+
RUN dnf config-manager \
5456
--add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo \
55-
&& dnf install -y --disableplugin=subscription-manager \
57+
&& dnf install -y \
5658
cuda-libraries-11-8-${NV_CUDA_LIB_VERSION} \
5759
cuda-nvtx-11-8-${NV_NVTX_VERSION} \
5860
libnpp-11-8-${NV_LIBNPP_VERSION} \
5961
libcublas-11-8-${NV_LIBCUBLAS_VERSION} \
6062
libnccl-${NV_LIBNCCL_PACKAGE_VERSION} \
61-
&& dnf clean all --disableplugin=subscription-manager
63+
&& dnf clean all
6264

6365
## CUDA Development ############################################################
6466
FROM cuda-base as cuda-devel
@@ -69,9 +71,9 @@ ENV NV_CUDA_CUDART_DEV_VERSION=11.8.89-1 \
6971
NV_LIBNPP_DEV_VERSION=11.8.0.86-1 \
7072
NV_LIBNCCL_DEV_PACKAGE_VERSION=2.15.5-1+cuda11.8
7173

72-
RUN dnf config-manager --disableplugin=subscription-manager \
74+
RUN dnf config-manager \
7375
--add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo \
74-
&& dnf install -y --disableplugin=subscription-manager make \
76+
&& dnf install -y \
7577
cuda-command-line-tools-11-8-${NV_CUDA_LIB_VERSION} \
7678
cuda-libraries-devel-11-8-${NV_CUDA_LIB_VERSION} \
7779
cuda-minimal-build-11-8-${NV_CUDA_LIB_VERSION} \
@@ -80,7 +82,7 @@ RUN dnf config-manager --disableplugin=subscription-manager \
8082
libcublas-devel-11-8-${NV_LIBCUBLAS_DEV_VERSION} \
8183
libnpp-devel-11-8-${NV_LIBNPP_DEV_VERSION} \
8284
libnccl-devel-${NV_LIBNCCL_DEV_PACKAGE_VERSION} \
83-
&& dnf clean all --disableplugin=subscription-manager
85+
&& dnf clean all
8486

8587
ENV LIBRARY_PATH="$CUDA_HOME/lib64/stubs"
8688

@@ -126,8 +128,8 @@ RUN cargo install --path .
126128
## Tests base ##################################################################
127129
FROM base as test-base
128130

129-
RUN dnf install -y --disableplugin=subscription-manager make unzip python39 python3-pip gcc openssl-devel gcc-c++ && \
130-
dnf clean all --disableplugin=subscription-manager && \
131+
RUN dnf install -y make unzip python39 python3-pip gcc openssl-devel gcc-c++ && \
132+
dnf clean all && \
131133
ln -s /usr/bin/python3 /usr/local/bin/python && ln -s /usr/bin/pip3 /usr/local/bin/pip
132134

133135
RUN pip install --upgrade pip && pip install pytest && pip install pytest-asyncio
@@ -139,16 +141,12 @@ ENV CUDA_VISIBLE_DEVICES=""
139141
FROM test-base as cpu-tests
140142
ARG PYTORCH_INDEX
141143
ARG PYTORCH_VERSION
142-
ARG OPTIMUM_VERSION
143144

144145
WORKDIR /usr/src
145146

146147
# Install specific version of torch
147148
RUN pip install torch=="$PYTORCH_VERSION+cpu" --index-url "${PYTORCH_INDEX}/cpu" --no-cache-dir
148149

149-
# Install optimum - not used in tests for now
150-
#RUN pip install optimum==$OPTIMUM_VERSION --no-cache-dir
151-
152150
COPY server/Makefile server/Makefile
153151

154152
# Install server
@@ -175,13 +173,8 @@ RUN cd integration_tests && make install
175173
FROM cuda-devel as python-builder
176174
ARG PYTORCH_INDEX
177175
ARG PYTORCH_VERSION
178-
ARG OPTIMUM_VERSION
179176

180-
RUN dnf install -y --disableplugin=subscription-manager \
181-
unzip \
182-
git \
183-
ninja-build \
184-
&& dnf clean all --disableplugin=subscription-manager
177+
RUN dnf install -y unzip git ninja-build && dnf clean all
185178

186179
RUN cd ~ && \
187180
curl -L -O https://repo.anaconda.com/miniconda/Miniconda3-py39_23.5.2-0-Linux-x86_64.sh && \
@@ -222,18 +215,6 @@ FROM python-builder as build
222215
COPY server/custom_kernels/ /usr/src/.
223216
RUN cd /usr/src && python setup.py build_ext && python setup.py install
224217

225-
# Install optimum
226-
RUN pip install optimum[onnxruntime-gpu]==$OPTIMUM_VERSION --no-cache-dir
227-
228-
# Install onnx
229-
COPY server/Makefile-onnx server/Makefile
230-
RUN cd server && make install-onnx
231-
232-
# Install onnx runtime
233-
COPY server/Makefile-onnx-runtime server/Makefile
234-
RUN cd server && make install-onnx-runtime
235-
236-
237218
## Flash attention cached build image ##########################################
238219
FROM base as flash-att-cache
239220
COPY --from=flash-att-builder /usr/src/flash-attention/build /usr/src/flash-attention/build
@@ -250,8 +231,7 @@ COPY --from=flash-att-v2-builder /usr/src/flash-attention-v2/build /usr/src/flas
250231
FROM cuda-runtime as server-release
251232

252233
# Install C++ compiler (required at runtime when PT2_COMPILE is enabled)
253-
RUN dnf install -y --disableplugin=subscription-manager gcc-c++ \
254-
&& dnf clean all --disableplugin=subscription-manager \
234+
RUN dnf install -y gcc-c++ && dnf clean all \
255235
&& useradd -u 2000 tgis -m -g 0
256236

257237
SHELL ["/bin/bash", "-c"]
@@ -275,7 +255,7 @@ COPY proto proto
275255
COPY server server
276256
RUN cd server && \
277257
make gen-server && \
278-
pip install ".[bnb, accelerate]" --no-cache-dir
258+
pip install ".[bnb, accelerate, onnx-gpu]" --no-cache-dir
279259

280260
# Patch codegen model changes into transformers 4.31
281261
RUN cp server/transformers_patch/modeling_codegen.py \

integration_tests/poetry.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration_tests/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = ["Nick Hill"]
88
python = "^3.9"
99

1010
[tool.poetry.group.dev.dependencies]
11-
protobuf = "^4.23.4"
11+
protobuf = "^4.24.0"
1212
grpcio-tools = "^1.56.2"
1313
pytest = "^7.4.0"
1414
pytest-asyncio = "^0.21.1"

server/Makefile-onnx

Lines changed: 0 additions & 5 deletions
This file was deleted.

server/Makefile-onnx-runtime

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)