Skip to content

Commit 8303322

Browse files
authored
adding tensorrt (#10)
1 parent d5e013e commit 8303322

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

.devcontainer/Dockerfile

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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
1515
ARG 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/*
3336
ENV 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
4151
RUN 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
7383
ARG USERNAME
74-
ARG USER_GID
75-
ARG USER_UID
7684
ARG ROS_DISTRO
7785

7886
# Cater image to user
7987
SHELL ["/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 \

.devcontainer/generate_devcontainer.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,20 @@ CUDA_VERSION=${3:-12.4.0}
2525
UBUNTU_VERSION=${4:-22.04}
2626
USERNAME=${USER:-vscode}
2727

28+
# TensorRT configuration
29+
TENSORRT_RUNTIME_VERSION="10.9.0.34"
30+
# Truncate CUDA version to major.minor for TensorRT
31+
TENSORRT_CUDA_VERSION="12.8"
32+
2833
echo "Generating devcontainer configuration..."
2934
echo "ROS Distribution: $ROS_DISTRO"
3035
echo "Container Type: $CONTAINER_TYPE"
3136

3237
if [ "$CONTAINER_TYPE" = "gpu" ]; then
3338
echo "CUDA Version: $CUDA_VERSION"
3439
echo "Ubuntu Version: $UBUNTU_VERSION"
40+
echo "TensorRT Runtime Version: $TENSORRT_RUNTIME_VERSION"
41+
echo "TensorRT CUDA Version: $TENSORRT_CUDA_VERSION"
3542
fi
3643

3744
# Generate container name and build args based on type
@@ -42,6 +49,8 @@ if [ "$CONTAINER_TYPE" = "gpu" ]; then
4249
"TARGETARCH": "gpu",
4350
"CUDA_VERSION": "'$CUDA_VERSION'",
4451
"UBUNTU_VERSION": "'$UBUNTU_VERSION'",
52+
"TENSORRT_RUNTIME_VERSION": "'$TENSORRT_RUNTIME_VERSION'",
53+
"TENSORRT_CUDA_VERSION": "'$TENSORRT_CUDA_VERSION'",
4554
"USER_UID": "'$(id -u)'",
4655
"USER_GID": "'$(id -g)'"'
4756
RUN_ARGS='"--network=host",

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ log/
1010
# Claude helpers
1111
.claude/
1212
CLAUDE.md
13+
14+
# VScode artifacts
15+
browse.vc.db
16+
browse.vc.db-shm
17+
browse.vc.db-wal

.vscode/tasks.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,15 @@
7676
"type": "pickString",
7777
"description": "Select CUDA version",
7878
"options": [
79+
"12.8.0",
7980
"12.6.2",
81+
"12.5.1",
82+
"12.4.1",
8083
"12.4.0",
84+
"12.3.2",
8185
"12.2.2",
8286
"12.1.1",
83-
"11.8.0"
87+
"12.0.1"
8488
],
8589
"default": "12.4.0"
8690
},

0 commit comments

Comments
 (0)