Skip to content

Commit 726d62e

Browse files
committed
fix(docker): streamline environment variable logging in l4t images
- Consolidated and relocated environment variable logging commands to improve clarity and avoid redundancy during the Docker build process. - Added `platforms` property to `docker-compose` build stages to ensure builds explicitly target `linux/amd64` platform. - Improved debugging by logging requirement file contents during installation and ensuring Python package installations include Nvidia's PyPI index. Issue NMO-794
1 parent 5b3bcaf commit 726d62e

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

dockerized-norlab-images/core-images/base-images/l4t-images/Dockerfile.l4t.squash

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ ENV CUDA_NVCC_EXECUTABLE=${CUDA_NVCC_EXECUTABLE}
163163
ENV CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES}
164164

165165
RUN <<EOF
166+
echo "Log build time environment variable..."
167+
printenv
168+
166169
echo "(deb) Install basic utilities..."
167170

168171
# ....Setup Sources............................................................................
@@ -180,9 +183,6 @@ RUN <<EOF
180183
lsb-release \
181184
|| exit 1
182185

183-
echo "Log build time environment variable..."
184-
printenv
185-
186186
# Update symlink to point to system python3 instead of system python2
187187
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 || exit 1
188188
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 || exit 1
@@ -210,6 +210,9 @@ SHELL ["/bin/bash", "-c"]
210210
ARG UBUNTU_VERSION_MAJOR
211211

212212
RUN <<EOF
213+
echo "Log build time environment variable..."
214+
printenv
215+
213216
# ....Check pre-conditions.......................................................................
214217
{
215218
test -n "${UBUNTU_VERSION_MAJOR:?'Env variable need to be set and non-empty.'}" && \
@@ -235,8 +238,6 @@ RUN <<EOF
235238
python3-dev \
236239
python3-pip
237240

238-
echo "Log build time environment variable..."
239-
printenv
240241

241242
IMG_RELEASE="$( source /etc/lsb-release && echo ${DISTRIB_RELEASE})"
242243
if [[ "${UBUNTU_VERSION_MAJOR:?err}.04" != "${IMG_RELEASE}" ]]; then
@@ -281,6 +282,9 @@ ENV IS_TEAMCITY_RUN=${IS_TEAMCITY_RUN:-false}
281282
COPY --from=base-image /requirements.l4t-base-image.txt /requirements.l4t-base-image.txt
282283

283284
RUN <<EOF
285+
echo "Log build time environment variable..."
286+
printenv
287+
284288
# ....Check pre-conditions.....................................................................
285289
{
286290
test -n "${UBUNTU_VERSION_MAJOR:?'Env variable need to be set and non-empty.'}" && \
@@ -291,9 +295,8 @@ RUN <<EOF
291295
} || { echo -e "\033[1;31m[DN error]\033[0m Failed pre-condition check" 1>&2 ; exit 1 ; }
292296

293297
# ....Reinstall l4t image package in amd64 image...............................................
294-
apt-get update
295-
296298
if [[ ${TARGETPLATFORM} =~ "linux/amd64".* ]]; then
299+
apt-get update
297300

298301
echo "Install general utilities..."
299302
apt-get install --assume-yes --no-install-recommends \
@@ -330,6 +333,10 @@ RUN <<EOF
330333
# ....Install l4t image ubuntu apt requirement.................................................
331334
if [[ ${TARGETPLATFORM} =~ "linux/amd64".* ]]; then
332335
echo "Install l4t image ubuntu apt requirement..."
336+
337+
echo "Log requirements.l4t-base-image.txt for debuging..."
338+
cat /requirements.l4t-base-image.txt
339+
333340
# Install pycuda related
334341
# Build instruction: https://github.com/berlinguyinca/pycuda/blob/master/doc/source/install.rst
335342
#
@@ -340,11 +347,12 @@ RUN <<EOF
340347
# ....Install l4t image python requirement from file...........................................
341348
echo "Install l4t image python requirement from file..."
342349
# Requirement for 'graphsurgeon' and 'uff', it give access to nvidia pip index
343-
python3 -m pip install onnx_graphsurgeon uff --extra-index-url https://pypi.ngc.nvidia.com || pip3 install --no-cache-dir nvidia-pyindex || exit 1
350+
python3 -m pip install onnx_graphsurgeon uff --extra-index-url https://pypi.ngc.nvidia.com
351+
#|| pip3 install --no-cache-dir nvidia-pyindex
344352

345353
echo "Strip versions from requirement"
346354
sed -i.bak 's/==.*//g' /requirements.l4t-base-image.txt
347-
pip3 install -r /requirements.l4t-base-image.txt || exit 1
355+
pip3 install -r /requirements.l4t-base-image.txt --extra-index-url https://pypi.ngc.nvidia.com
348356

349357
# Clean up sed tmp file
350358
rm /requirements.l4t-base-image.txt.bak

dockerized-norlab-images/core-images/base-images/l4t-images/docker-compose.l4t-squash.build.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ services:
8888
service: l4t-base-image-amd64
8989
build:
9090
target: mimic-l4t-image
91+
platforms: !override
92+
- linux/amd64
9193
depends_on:
9294
- l4t-base-image-amd64
9395

@@ -107,6 +109,8 @@ services:
107109
image: ${DN_HUB:?err}/dockerized-norlab-base-image:${DN_IMAGE_TAG:?err}-amd64
108110
build:
109111
target: final-amd64
112+
platforms: !override
113+
- linux/amd64
110114
depends_on:
111115
- l4t-base-image-mimic-l4t-image
112116

@@ -124,6 +128,8 @@ services:
124128
service: l4t-base-image-amd64
125129
build:
126130
target: test
131+
platforms: !override
132+
- linux/amd64
127133
depends_on:
128134
- l4t-base-image-amd64-final
129135

0 commit comments

Comments
 (0)