Skip to content

Commit d50edf0

Browse files
committed
update dockerfile for trt
1 parent f50d05c commit d50edf0

File tree

3 files changed

+69
-23
lines changed

3 files changed

+69
-23
lines changed

yolox_ros_cpp/docker/tensorrt/docker-compose.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ version: '3.4'
22
services:
33
yolox_ros:
44
container_name: yolox_tensorrt
5-
# build:
6-
# context: .
7-
# args:
8-
# - BASE_TAB=21.09-py3
9-
image: fateshelled/tensorrt_yolox_ros:latest
5+
build:
6+
context: .
7+
args:
8+
- TENSORRT_VERSION=8.6
9+
- CUDNN_VERSION=8.8
10+
- PYTHON_VERSION=3.10
1011
network_mode: host
1112
runtime: nvidia
1213
environment:

yolox_ros_cpp/docker/tensorrt/dockerfile

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
1-
ARG BASE_TAG=21.09-py3
2-
FROM nvcr.io/nvidia/pytorch:${BASE_TAG}
1+
# pytorch/TensorRT/docker/Dockerfile
2+
# Base image starts with CUDA
3+
ARG BASE_IMG=nvidia/cuda:12.1.1-devel-ubuntu22.04
4+
FROM ${BASE_IMG} as base
5+
ENV BASE_IMG=nvidia/cuda:12.1.1-devel-ubuntu22.04
6+
7+
ARG TENSORRT_VERSION
8+
ENV TENSORRT_VERSION=${TENSORRT_VERSION}
9+
RUN test -n "$TENSORRT_VERSION" || (echo "No tensorrt version specified, please use --build-arg TENSORRT_VERSION=x.y to specify a version." && exit 1)
10+
ARG CUDNN_VERSION
11+
ENV CUDNN_VERSION=${CUDNN_VERSION}
12+
RUN test -n "$CUDNN_VERSION" || (echo "No cudnn version specified, please use --build-arg CUDNN_VERSION=x.y to specify a version." && exit 1)
13+
14+
ARG PYTHON_VERSION=3.10
15+
ENV PYTHON_VERSION=${PYTHON_VERSION}
16+
17+
ARG USE_CXX11_ABI
18+
ENV USE_CXX11=${USE_CXX11_ABI}
19+
ENV DEBIAN_FRONTEND=noninteractive
20+
21+
# Install basic dependencies
22+
RUN apt-get update
23+
RUN apt install -y build-essential manpages-dev wget zlib1g software-properties-common git libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget ca-certificates curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev mecab-ipadic-utf8
24+
25+
# Install PyEnv and desired Python version
26+
ENV HOME="/root"
27+
ENV PYENV_DIR="$HOME/.pyenv"
28+
ENV PATH="$PYENV_DIR/shims:$PYENV_DIR/bin:$PATH"
29+
RUN wget -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer &&\
30+
chmod 755 pyenv-installer &&\
31+
bash pyenv-installer &&\
32+
eval "$(pyenv init -)"
33+
34+
RUN pyenv install -v ${PYTHON_VERSION}
35+
RUN pyenv global ${PYTHON_VERSION}
36+
37+
# Install CUDNN + TensorRT + dependencies
38+
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
39+
RUN mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
40+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/7fa2af80.pub
41+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 536F8F1DE80F6A35
42+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC
43+
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
44+
RUN apt-get update
45+
RUN apt-get install -y libcudnn8=${CUDNN_VERSION}* libcudnn8-dev=${CUDNN_VERSION}*
46+
47+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
48+
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
49+
RUN apt-get update
50+
51+
RUN apt-get install -y libnvinfer8=${TENSORRT_VERSION}.* libnvinfer-plugin8=${TENSORRT_VERSION}.* libnvinfer-dev=${TENSORRT_VERSION}.* libnvinfer-plugin-dev=${TENSORRT_VERSION}.* libnvonnxparsers8=${TENSORRT_VERSION}.* libnvonnxparsers-dev=${TENSORRT_VERSION}.* libnvparsers8=${TENSORRT_VERSION}.* libnvparsers-dev=${TENSORRT_VERSION}.*
352

453
ENV DEBIAN_FRONTEND=noninteractive
554

@@ -11,15 +60,19 @@ RUN apt update && apt install locales && \
1160
ENV LANG=en_US.UTF-8
1261

1362
RUN apt update && \
14-
apt install -y curl gnupg2 lsb-release && \
15-
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
63+
apt install -y git wget curl gnupg2 lsb-release && \
64+
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
1665
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && \
17-
sed -i -e 's/ubuntu .* main/ubuntu focal main/g' /etc/apt/sources.list.d/ros2.list && \
66+
sed -i -e 's/ubuntu .* main/ubuntu jammy main/g' /etc/apt/sources.list.d/ros2.list && \
1867
apt update && \
19-
apt install -y ros-foxy-ros-base && \
20-
apt install -y python3-colcon-common-extensions && \
21-
apt install -y ros-foxy-v4l2-camera && \
22-
apt install -y ros-foxy-cv-bridge &&\
68+
apt install -y ros-dev-tools \
69+
ros-humble-cv-bridge \
70+
ros-humble-generate-parameter-library \
71+
ros-humble-parameter-traits \
72+
ros-humble-ros-base \
73+
ros-humble-rqt-image-view \
74+
ros-humble-v4l2-camera && \
75+
apt -y clean && \
2376
rm -rf /var/lib/apt/lists/* &&\
2477
apt -y clean && \
2578
pip install -U pip && \
@@ -28,14 +81,6 @@ RUN apt update && \
2881
pip install lark && \
2982
python3 -m pip cache purge
3083

31-
WORKDIR /workspace
32-
ENV YOLOX_VERSION=0.2.0
33-
RUN git clone https://github.com/Megvii-BaseDetection/YOLOX -b $YOLOX_VERSION && \
34-
cd YOLOX && \
35-
python3 -m pip install -r requirements.txt && \
36-
python3 setup.py install && \
37-
python3 -m pip cache purge
38-
3984
COPY ./ros_entrypoint.sh /ros_entrypoint.sh
4085
RUN echo "source /ros_entrypoint.sh" >> /root/.bashrc
4186
# ENTRYPOINT ["/ros_entrypoint.sh"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
2-
source /opt/ros/foxy/setup.bash
2+
source /opt/ros/humble/setup.bash
33
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash

0 commit comments

Comments
 (0)