forked from triton-inference-server/model_analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
102 lines (83 loc) · 3.82 KB
/
Dockerfile
File metadata and controls
102 lines (83 loc) · 3.82 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
98
99
100
101
# Copyright (c) 2020-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASE_IMAGE=nvcr.io/nvidia/tritonserver:22.04-py3
ARG TRITONSDK_BASE_IMAGE=nvcr.io/nvidia/tritonserver:22.04-py3-sdk
ARG MODEL_ANALYZER_VERSION=1.17.0dev
ARG MODEL_ANALYZER_CONTAINER_VERSION=22.06dev
FROM ${TRITONSDK_BASE_IMAGE} as sdk
FROM $BASE_IMAGE
ARG MODEL_ANALYZER_VERSION
ARG MODEL_ANALYZER_CONTAINER_VERSION
ARG BASE_IMAGE
ARG TRITONSDK_BASE_IMAGE
# DCGM version to install for Model Analyzer
ENV DCGM_VERSION=2.2.9
# Ensure apt-get won't prompt for selecting options
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-key del 7fa2af80 && apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/$(uname -m)/3bf863cc.pub
RUN apt-get update && \
apt-get install -y python3-dev
RUN mkdir -p /opt/triton-model-analyzer
# Install architecture-specific components
ARG TARGETARCH
RUN \
# Set TARGETARCH variable if in a non-docker buildx build
if [ "${TARGETARCH}" = "" ] ; then \
if [ `uname -m` = "x86_64" ] ; then TARGETARCH="amd64" ; \
elif [ `uname -m` = "aarch64" ] ; then TARGETARCH="arm64" ; \
fi ; \
fi ; \
# Exit if TARGETARCH variable is an invalid value
if [ "${TARGETARCH}" != "amd64" ] && [ "${TARGETARCH}" != "arm64" ] ; then \
echo "invalid architecture: $(uname -m)" ; exit 1 ; \
fi ; \
# Set ARCH_DIR variable for correct architecture-specific DCGM installation
if [ "${TARGETARCH}" = "amd64" ] ; then ARCH_DIR="x86_64" ; \
elif [ "${TARGETARCH}" = "arm64" ] ; then ARCH_DIR="sbsa" ; \
fi ; \
# Install DCGM
apt-get update && apt-get install -y --no-install-recommends software-properties-common && \
apt-get install -y datacenter-gpu-manager=1:${DCGM_VERSION}; \
# Install Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
echo \
"deb [arch=${TARGETARCH} signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && apt-get install -y docker-ce-cli
# Install tritonclient
COPY --from=sdk /workspace/install/python /tmp/tritonclient
RUN find /tmp/tritonclient -maxdepth 1 -type f -name \
"tritonclient-*-manylinux*.whl" | xargs printf -- '%s[all]' | \
xargs pip3 install --upgrade && rm -rf /tmp/tritonclient/
WORKDIR /opt/triton-model-analyzer
RUN rm -fr *
COPY --from=sdk /usr/local/bin/perf_analyzer .
RUN chmod +x ./perf_analyzer
COPY . .
RUN chmod +x /opt/triton-model-analyzer/nvidia_entrypoint.sh
RUN chmod +x build_wheel.sh && \
./build_wheel.sh perf_analyzer true && \
rm -f perf_analyzer
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install nvidia-pyindex && \
python3 -m pip install wheels/triton_model_analyzer-*-manylinux*.whl
#Other pip packages
RUN python3 -m pip install \
coverage
RUN apt-get install -y wkhtmltopdf
ENTRYPOINT ["/opt/triton-model-analyzer/nvidia_entrypoint.sh"]
ENV MODEL_ANALYZER_VERSION ${MODEL_ANALYZER_VERSION}
ENV MODEL_ANALYZER_CONTAINER_VERSION ${MODEL_ANALYZER_CONTAINER_VERSION}
ENV TRITON_SERVER_SDK_CONTAINER_IMAGE_NAME ${TRITONSDK_BASE_IMAGE}
ENV TRITON_SERVER_CONTAINER_IMAGE_NAME ${BASE_IMAGE}