@@ -6,13 +6,15 @@ ARG UBUNTU_VERSION=22.04
66# ===============================================
77# CPU Base - Standard ROS2 image
88# ===============================================
9- FROM ros:${ROS_DISTRO}-ros-base as cpu-base
9+ FROM ros:${ROS_DISTRO}-ros-base AS cpu-base
1010
1111# ===============================================
1212# GPU Base - CUDA with manual ROS2 install
1313# ===============================================
14- FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} as gpu-base
14+ FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} AS gpu-base
1515ARG ROS_DISTRO
16+ ARG TENSORRT_RUNTIME_VERSION
17+ ARG TENSORRT_CUDA_VERSION
1618
1719# Install ROS2 manually since we're not using the ros: base image
1820# Set non-interactive to avoid geographic area prompts
@@ -23,6 +25,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2325 gnupg2 \
2426 lsb-release \
2527 tzdata \
28+ wget \
2629 && ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime \
2730 && dpkg-reconfigure --frontend noninteractive tzdata \
2831 && curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
@@ -32,10 +35,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3235 && rm -rf /var/lib/apt/lists/*
3336ENV DEBIAN_FRONTEND=interactive
3437
38+ # Install Tensorrt Runtime
39+ RUN curl -fsSL -o cuda-keyring_1.1-1_all.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
40+ && dpkg -i cuda-keyring_1.1-1_all.deb \
41+ && apt-get update && apt-get install -y --no-install-recommends \
42+ libnvinfer-lean10=${TENSORRT_RUNTIME_VERSION}-1+cuda${TENSORRT_CUDA_VERSION} \
43+ && rm cuda-keyring_1.1-1_all.deb
44+
3545# ===============================================
3646# Install Common Development Tools from Either Base
3747# ===============================================
38- FROM ${TARGETARCH:-cpu}-base as dev-tools
48+ FROM ${TARGETARCH:-cpu}-base AS dev-tools
3949
4050# Install development tools not in base image
4151RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -69,17 +79,17 @@ WORKDIR /deep_ros_ws
6979# ===============================================
7080# Add User Configuration
7181# ===============================================
72- FROM dev-tools as user-conf
82+ FROM dev-tools AS user-conf
7383ARG USERNAME
74- ARG USER_GID
75- ARG USER_UID
7684ARG ROS_DISTRO
7785
7886# Cater image to user
7987SHELL ["/bin/bash" , "-c" ]
88+ COPY .env /tmp/.env
8089# hadolint ignore=SC2086
81- RUN groupadd --gid ${USER_GID} ${USERNAME} \
82- && useradd --uid ${USER_UID} --gid ${USER_GID} -m $USERNAME --shell /bin/bash \
90+ RUN source /tmp/.env && rm /tmp/.env \
91+ && groupadd --gid $USER_GID $USERNAME \
92+ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME --shell /bin/bash \
8393 && apt-get update \
8494 && apt-get install -y --no-install-recommends sudo \
8595 && echo $USERNAME ALL=\( ALL\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
0 commit comments