Skip to content

Commit

Permalink
merge apt install to make build step shorter
Browse files Browse the repository at this point in the history
  • Loading branch information
mqcmd196 committed Jan 16, 2025
1 parent 5b3ee77 commit 524e551
Showing 1 changed file with 21 additions and 30 deletions.
51 changes: 21 additions & 30 deletions l4t.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ RUN echo 'Etc/UTC' > /etc/timezone && \
apt-get install -q -y --no-install-recommends tzdata && \
rm -rf /var/lib/apt/lists/*

RUN apt update

# install minimum tools:
RUN apt install -y build-essential sudo git

RUN \
useradd user && \
echo "user ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user && \
Expand All @@ -24,13 +19,17 @@ RUN echo 'user:user' | chpasswd

# install packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
build-essential \
sudo \
git \
dirmngr \
gnupg2 \
curl \
lsb-release \
wget \
&& rm -rf /var/lib/apt/lists/*

# setup sources.list
RUN sudo apt-get update && apt-get install -y lsb-release
RUN sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

# setup keys
Expand All @@ -39,38 +38,28 @@ RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sud
# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

ENV ROS_DISTRO noetic

# Remove OpenCV built with CUDA by NVIDIA. It conflicts with original OpenCV deb
RUN apt purge opencv-* -y

# install ros packages
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-noetic-ros-core=1.5.0-1* \
&& rm -rf /var/lib/apt/lists/*

# install bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
ros-noetic-ros-base=1.5.0-1* \
build-essential \
python3-rosdep \
python3-rosinstall \
python3-vcstools \
ros-noetic-jsk-tools \
ros-noetic-image-transport-plugins \
python3-osrf-pycommon \
python3-catkin-tools \
python3-wstool \
ros-noetic-jsk-pcl-ros \
ros-noetic-jsk-pcl-ros-utils \
&& rm -rf /var/lib/apt/lists/*

# install ros packages
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-noetic-ros-base=1.5.0-1* \
&& rm -rf /var/lib/apt/lists/*

RUN apt update && apt install python3-osrf-pycommon python3-catkin-tools python3-wstool -y

# Remove OpenCV built with CUDA by NVIDIA. It conflicts with original OpenCV deb
RUN apt purge opencv-* -y

RUN apt update && apt install ros-noetic-jsk-tools -y
RUN apt update && apt install ros-noetic-image-transport-plugins -y

# install launch/sample_detection.launch dependencies if you work with point clouds
RUN apt-get update && apt-get install -y ros-noetic-jsk-pcl-ros ros-noetic-jsk-pcl-ros-utils

WORKDIR /home/user

USER user
Expand All @@ -82,24 +71,26 @@ SHELL ["/bin/bash", "-c"]
########################################
# Installing catkin package
RUN mkdir -p ~/detic_ws/src
RUN sudo apt install -y wget
RUN sudo rosdep init && rosdep update && sudo apt update
RUN sudo rosdep init && rosdep update

# Build detectron2 from source. The aarch64 version is not released
RUN cd /tmp &&\
git clone -b v0.6 https://github.com/facebookresearch/detectron2 &&\
pip3 install -e detectron2
pip3 install --no-cache-dir -e detectron2

COPY --chown=user . /home/user/detic_ws/src/detic_ros
RUN cd ~/detic_ws/src &&\
source /opt/ros/noetic/setup.bash &&\
wstool init &&\
wstool merge detic_ros/rosinstall.noetic &&\
wstool update &&\
sudo apt update &&\
rosdep install --from-paths . --ignore-src -y -r &&\
source /opt/ros/noetic/setup.bash &&\
rosdep install --from-paths . -i -r -y &&\
cd ~/detic_ws/src/detic_ros && ./prepare.sh &&\
rm -rf ~/.cache/pip &&\
sudo rm -rf /var/lib/apt/lists/* &&\
cd ~/detic_ws && catkin init && catkin build

# to avoid conflcit when mounting
Expand Down

0 comments on commit 524e551

Please sign in to comment.