Skip to content

Commit 6dd9aac

Browse files
committed
Merge branch 'refactor--and-improve-dir-structure-NMO-794'
2 parents ec33257 + 726d62e commit 6dd9aac

20 files changed

Lines changed: 121 additions & 105 deletions

build_matrix_config/dev/.env.build_matrix.dev

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#NBS_MATRIX_ROS_DISTRO=('none')
1212
#NBS_MATRIX_ROS_PKG=('none')
1313

14-
NBS_COMPOSE_DIR=dockerized-norlab-images/core-images/base-images/ros2-install
15-
NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.ros2.build.yaml"
16-
#NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.ros2-vaul.build.yaml"
14+
#NBS_COMPOSE_DIR=dockerized-norlab-images/core-images/base-images/ros2-install
15+
#NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.ros2.build.yaml"
16+
##NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.ros2-vaul.build.yaml"
1717

1818
#NBS_COMPOSE_DIR=dockerized-norlab-images/core-images/dependencies
1919
#NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.dn-dependencies.build.yaml"
@@ -26,8 +26,8 @@ NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.ro
2626
#NBS_COMPOSE_DIR=dockerized-norlab-images/core-images/pkg-perception
2727
#NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.dn-perception.build.yaml"
2828

29-
#NBS_COMPOSE_DIR=dockerized-norlab-images/core-images/dn-project
30-
#NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.dn-project.build.yaml"
29+
NBS_COMPOSE_DIR=dockerized-norlab-images/core-images/dn-project
30+
NBS_EXECUTE_BUILD_MATRIX_OVER_COMPOSE_FILE="${NBS_COMPOSE_DIR}/docker-compose.dn-project.build.yaml"
3131

3232
#
3333
# Build Dockerized-NorLab for the following base images

build_matrix_config/dev/run_config_buidl_over_single_build_matrix.bash

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ function buidl_over_single_build_matrix() {
2626
# docker_flag+=( l4t-base-image-amd64-tester )
2727

2828
# ....ROS2-install base images...................................................................
29-
docker_flag+=( base-image-ros2-clean-main )
30-
docker_flag+=( base-image-ros2-clean-tester )
31-
docker_flag+=( base-image-ros2-clean )
29+
# docker_flag+=( base-image-ros2-clean-main )
30+
# docker_flag+=( base-image-ros2-clean-tester )
31+
# docker_flag+=( base-image-ros2-clean )
3232

3333
# ....dependencies images........................................................................
3434
# docker_flag+=( dependencies-core-main )
@@ -58,15 +58,15 @@ function buidl_over_single_build_matrix() {
5858
# docker_flag+=( dn-control-deep-rl-f1tenth-gym ) # final
5959

6060
# ....dn-project images............................................................................
61-
# docker_flag+=( project-core-main )
62-
# docker_flag+=( project-core )
63-
# docker_flag+=( project-develop-main )
64-
# docker_flag+=( project-develop-test-ssh-user )
65-
# docker_flag+=( project-develop-test-project-user )
66-
# docker_flag+=( project-develop )
67-
# docker_flag+=( project-deploy-main )
68-
# docker_flag+=( project-deploy-tester )
69-
# docker_flag+=( project-deploy )
61+
docker_flag+=( project-core-main )
62+
docker_flag+=( project-core )
63+
docker_flag+=( project-develop-main )
64+
docker_flag+=( project-develop-test-ssh-user )
65+
docker_flag+=( project-develop-test-project-user )
66+
docker_flag+=( project-develop )
67+
docker_flag+=( project-deploy-main )
68+
docker_flag+=( project-deploy-tester )
69+
docker_flag+=( project-deploy )
7070

7171
# ....Script flag..................................................................................
7272
local script_flag=()

dockerized-norlab-images/container-tools/dn_install_debugging_tools.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function dn::setup_debugging_tools() {
110110

111111
n2st::print_msg_warning "Be advised, the ssh daemon still need to be started.
112112
Curently its done by 'dn_entrypoint.global.init.callback.bash'.
113-
Ref 'dockerized-norlab-images/core-images/dn-project/project-core/project_entrypoints'.
113+
Ref 'dockerized-norlab-images/core-images/dn-project/project-core/entrypoints'.
114114
"
115115

116116
# ....Set password for users.......................................................................

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

Lines changed: 66 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ RUN <<EOF
3030
--exclude torchaudio \
3131
--exclude tensorrt \
3232
--exclude torch2trt \
33-
--exclude pycuda
33+
--exclude pycuda \
34+
--exclude nvidia-pyindex
3435
) > /requirements.l4t-base-image.txt
3536

3637
# ....Builder sanity check.....................................................................
@@ -103,37 +104,6 @@ COPY --from=base-image / /
103104
#COPY --from=base-image /opt /opt
104105
#COPY --from=base-image ${ROS_ROOT} ${ROS_ROOT}
105106

106-
RUN <<EOF
107-
echo "(deb) Install basic utilities..."
108-
109-
# ....Setup Sources............................................................................
110-
{
111-
apt-get update \
112-
&& apt-get install --assume-yes --no-install-recommends \
113-
software-properties-common \
114-
&& add-apt-repository --yes universe \
115-
&& apt-get update;
116-
} || exit 1
117-
118-
apt-get install --assume-yes --no-install-recommends \
119-
curl \
120-
pkg-config \
121-
lsb-release \
122-
|| exit 1
123-
124-
echo "Log build time environment variable..."
125-
printenv
126-
127-
# Update symlink to point to system python3 instead of system python2
128-
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 || exit 1
129-
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 || exit 1
130-
131-
# ....Teardown.................................................................................
132-
apt-get autoremove --assume-yes
133-
apt-get clean
134-
rm -rf /var/lib/apt/lists/*
135-
EOF
136-
137107
# ....Transfer environment variable from base-images...............................................
138108
# Env var specific to 'nvcr.io/nvidia/l4t-jetpack' base images
139109
ARG CUDA_HOME
@@ -192,6 +162,37 @@ ENV NVCC_PATH=${NVCC_PATH}
192162
ENV CUDA_NVCC_EXECUTABLE=${CUDA_NVCC_EXECUTABLE}
193163
ENV CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES}
194164

165+
RUN <<EOF
166+
echo "Log build time environment variable..."
167+
printenv
168+
169+
echo "(deb) Install basic utilities..."
170+
171+
# ....Setup Sources............................................................................
172+
{
173+
apt-get update \
174+
&& apt-get install --assume-yes --no-install-recommends \
175+
software-properties-common \
176+
&& add-apt-repository --yes universe \
177+
&& apt-get update;
178+
} || exit 1
179+
180+
apt-get install --assume-yes --no-install-recommends \
181+
curl \
182+
pkg-config \
183+
lsb-release \
184+
|| exit 1
185+
186+
# Update symlink to point to system python3 instead of system python2
187+
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 || exit 1
188+
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 || exit 1
189+
190+
# ....Teardown.................................................................................
191+
apt-get autoremove --assume-yes
192+
apt-get clean
193+
rm -rf /var/lib/apt/lists/*
194+
EOF
195+
195196

196197
FROM --platform=linux/amd64 ${MIMIC_DEPENDENCIES_BASE_IMAGE:?err}:${MIMIC_DEPENDENCIES_BASE_IMAGE_TAG:?err} AS base-image-amd64
197198
ARG TARGETPLATFORM
@@ -209,6 +210,9 @@ SHELL ["/bin/bash", "-c"]
209210
ARG UBUNTU_VERSION_MAJOR
210211

211212
RUN <<EOF
213+
echo "Log build time environment variable..."
214+
printenv
215+
212216
# ....Check pre-conditions.......................................................................
213217
{
214218
test -n "${UBUNTU_VERSION_MAJOR:?'Env variable need to be set and non-empty.'}" && \
@@ -234,8 +238,6 @@ RUN <<EOF
234238
python3-dev \
235239
python3-pip
236240

237-
echo "Log build time environment variable..."
238-
printenv
239241

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

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

292297
# ....Reinstall l4t image package in amd64 image...............................................
293-
apt-get update
294-
295298
if [[ ${TARGETPLATFORM} =~ "linux/amd64".* ]]; then
299+
apt-get update
296300

297301
echo "Install general utilities..."
298302
apt-get install --assume-yes --no-install-recommends \
@@ -327,23 +331,28 @@ RUN <<EOF
327331
fi
328332

329333
# ....Install l4t image ubuntu apt requirement.................................................
330-
echo "Install l4t image ubuntu apt requirement..."
331-
# Install pycuda related
332-
# Build instruction: https://github.com/berlinguyinca/pycuda/blob/master/doc/source/install.rst
333-
#
334-
# Requirement for 'pycairo' which is required by 'pycuda'
335-
apt-get install --assume-yes --no-install-recommends \
336-
libcairo2-dev
334+
if [[ ${TARGETPLATFORM} =~ "linux/amd64".* ]]; then
335+
echo "Install l4t image ubuntu apt requirement..."
337336

338-
# ....Install l4t image python requirement from file...........................................
339-
echo "Install l4t image python requirement from file..."
340-
# Requirement for 'graphsurgeon' and 'uff', it give access to nvidia pip index
341-
pip3 install --no-cache-dir nvidia-pyindex
337+
echo "Log requirements.l4t-base-image.txt for debuging..."
338+
cat /requirements.l4t-base-image.txt
339+
340+
# Install pycuda related
341+
# Build instruction: https://github.com/berlinguyinca/pycuda/blob/master/doc/source/install.rst
342+
#
343+
# Requirement for 'pycairo' which is required by 'pycuda'
344+
apt-get install --assume-yes --no-install-recommends \
345+
libcairo2-dev
346+
347+
# ....Install l4t image python requirement from file...........................................
348+
echo "Install l4t image python requirement from file..."
349+
# Requirement for 'graphsurgeon' and 'uff', it give access to nvidia pip index
350+
python3 -m pip install onnx_graphsurgeon uff --extra-index-url https://pypi.ngc.nvidia.com
351+
#|| pip3 install --no-cache-dir nvidia-pyindex
342352

343-
if [[ ${TARGETPLATFORM} =~ "linux/amd64".* ]]; then
344353
echo "Strip versions from requirement"
345354
sed -i.bak 's/==.*//g' /requirements.l4t-base-image.txt
346-
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
347356

348357
# Clean up sed tmp file
349358
rm /requirements.l4t-base-image.txt.bak
@@ -356,9 +365,8 @@ RUN <<EOF
356365
# - https://github.com/NVIDIA-AI-IOT/torch2trt
357366
# - https://github.com/dusty-nv/jetson-containers/blob/master/packages/pytorch/torch2trt/Dockerfile
358367
#
359-
360-
# pip3 install git+https://github.com/NVIDIA-AI-IOT/torch2trt
361368
if [[ ${TARGETPLATFORM} =~ "linux/amd64".* ]]; then
369+
# pip3 install git+https://github.com/NVIDIA-AI-IOT/torch2trt
362370
cd /opt
363371
git clone https://github.com/NVIDIA-AI-IOT/torch2trt
364372
cd torch2trt
@@ -392,6 +400,8 @@ ARG TARGETARCH
392400
ARG BUILDPLATFORM
393401

394402
RUN <<EOF
403+
echo "Test final"
404+
395405
# ....Check pre-conditions.......................................................................
396406
{
397407
test -n "${TARGETPLATFORM:?'Env variable need to be set and non-empty.'}" && \
@@ -422,11 +432,11 @@ RUN <<EOF
422432

423433
if [[ ${TARGETPLATFORM} =~ "linux/arm64".* ]]; then
424434
{
425-
test -n ${CUDA_HOME:?'Environment variable was not passed from base-image build stage to test stage'} && \
426-
test -n ${NVIDIA_VISIBLE_DEVICES:?'Environment variable was not passed from base-image build stage to test stage'} && \
427-
test -n ${NVIDIA_DRIVER_CAPABILITIES:?'Environment variable was not passed from base-image build stage to test stage'} && \
428-
test -n ${PATH:?'Environment variable was not passed from base-image build stage to test stage'} && \
429-
test -n ${LD_LIBRARY_PATH:?'Environment variable was not passed from base-image build stage to test stage'} ;
435+
test -n ${CUDA_HOME:?'(Final) Environment variable was not passed from base-image build stage to test stage'} && \
436+
test -n ${NVIDIA_VISIBLE_DEVICES:?'(Final) Environment variable was not passed from base-image build stage to test stage'} && \
437+
test -n ${NVIDIA_DRIVER_CAPABILITIES:?'(Final) Environment variable was not passed from base-image build stage to test stage'} && \
438+
test -n ${PATH:?'(Final) Environment variable was not passed from base-image build stage to test stage'} && \
439+
test -n ${LD_LIBRARY_PATH:?'(Final) Environment variable was not passed from base-image build stage to test stage'} ;
430440
} || { echo "Missing required environment variables!" 1>&2 ; exit 1 ; }
431441
fi
432442

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

dockerized-norlab-images/core-images/base-images/ubuntu-images/Dockerfile.cuda.squash

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ RUN touch /requirements.l4t-base-image.txt \
2424
--exclude torch2trt \
2525
--exclude torchaudio \
2626
--exclude tensorrt \
27+
--exclude nvidia-pyindex \
2728
> /requirements.l4t-base-image.txt
2829

2930
# ===Remove Jetson-container unused install========================================================
@@ -210,7 +211,7 @@ RUN apt-get update \
210211
ninja
211212

212213
# Requirement for 'graphsurgeon' and 'uff', it give access to nvidia pip index
213-
RUN pip3 install --no-cache-dir nvidia-pyindex
214+
RUN python3 -m pip install onnx_graphsurgeon uff --extra-index-url https://pypi.ngc.nvidia.com
214215

215216
# Requirement for 'pycairo' which is required by 'pycuda'
216217
RUN apt-get update \
@@ -249,7 +250,7 @@ RUN apt-get update \
249250

250251
# pycuda==2023.1 \
251252
# PySoundFile==0.9.0.post1 \
252-
RUN sed -i.bak 's/==.*//g' /requirements.l4t-base-image.txt \
253+
RUN sed -i.bak 's/==.*//g' /requirements.l4t-base-image.txt \
253254
&& rm /requirements.l4t-base-image.txt.bak
254255

255256
RUN pip3 install --no-cache-dir -r /requirements.l4t-base-image.txt

dockerized-norlab-images/core-images/dependencies/Dockerfile.ros2-dn-custom

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ RUN <<EOF
4444
osrf-pycommon \
4545
rosbags \
4646
rosbags-dataframe \
47-
rosbag-tools[plot] \
4847
|| exit 1
4948

5049
apt-get install --assume-yes --no-install-recommends \

dockerized-norlab-images/core-images/dn-project/project-core/Dockerfile.template

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ FROM project-setup AS project-custom-docker-steps
4141
# ====Project custom python libraries==============================================================
4242

4343
# (NICE TO HAVE) ToDo: refactor to dn_project_core_init.bash (ref task RLRP-213 and NMO-548)
44-
COPY ./project_requirements/python.requirements.txt /python.requirements.txt
45-
COPY ./project_requirements/shell.requirements.bash /shell.requirements.bash
44+
COPY ./build_stage/python.requirements.txt /python.requirements.txt
45+
COPY ./build_stage/shell.requirements.bash /shell.requirements.bash
4646

4747
# (NICE TO HAVE) ToDo: refactor to dn_project_core_init.bash (ref task RLRP-213 and NMO-548)
4848
RUN <<EOF
@@ -60,18 +60,18 @@ EOF
6060
# ====DN-project final=============================================================================
6161
FROM project-custom-docker-steps AS final
6262

63-
# (NICE TO HAVE) ToDo: refactor project_entrypoints logic a fct. Either in DN container-tools or in DN-project
63+
# (NICE TO HAVE) ToDo: refactor entrypoints logic a fct. Either in DN container-tools or in DN-project
6464
# Note: project-develop container mounth those directories as a volume to skip rebuilding
6565
# each time they are modify (see docker-compose.project.run.*.yaml). However, project-deploy
6666
# and project release container will need them copied in the image for portability.
67-
# Note: Files copied from project_entrypoints/ directory are required by Dockerized-NorLab
67+
# Note: Files copied from entrypoints/ directory are required by Dockerized-NorLab
6868
# dn_entrypoint.init.bash and dn_entrypoint.attach.bash
69-
WORKDIR /project_entrypoints
70-
ENV MOCK_PROJECT_ENTRYPOINT_PATH=./project_entrypoints
69+
WORKDIR /entrypoints
70+
ENV MOCK_PROJECT_ENTRYPOINT_PATH=./entrypoints
7171
COPY ${MOCK_PROJECT_ENTRYPOINT_PATH} .
7272
COPY --from=context-dn-container-tools ./dn_project_core_finalize.bash /dn_project_core_finalize.bash
7373
RUN <<EOF
74-
# Note: DN-project path would be ".dockerized_norlab_project/configuration/project_entrypoints"
74+
# Note: DN-project path would be ".dockerized_norlab_project/configuration/entrypoints"
7575
for each_file in ./dn_entrypoint.*.bash; do
7676
chmod +x "${each_file}"
7777
done

dockerized-norlab-images/core-images/dn-project/project-core/project_requirements/python.requirements.txt renamed to dockerized-norlab-images/core-images/dn-project/project-core/build_stage/python.requirements.txt

File renamed without changes.

dockerized-norlab-images/core-images/dn-project/project-core/project_requirements/shell.requirements.bash renamed to dockerized-norlab-images/core-images/dn-project/project-core/build_stage/shell.requirements.bash

File renamed without changes.

0 commit comments

Comments
 (0)