Skip to content

Commit

Permalink
devcontainer: Install rosdeps
Browse files Browse the repository at this point in the history
  • Loading branch information
marcojob committed Nov 1, 2024
1 parent c8d4073 commit 0922c05
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 15 deletions.
31 changes: 22 additions & 9 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM ros:noetic-ros-core
# Base Stage: ROS and CUDA Installation
FROM ros:noetic-ros-core AS base

ARG TZ=Europe/Zurich
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH="${PATH}:/opt/hpcx/ompi/bin"

# All apt packages
COPY devcontainer_all_packages.sh /tmp/devcontainer_all_packages.sh
COPY .devcontainer/devcontainer_all_packages.sh /tmp/devcontainer_all_packages.sh
RUN /tmp/devcontainer_all_packages.sh && rm -f /tmp/devcontainer_all_packages.sh

ENV LANG="en_US.UTF-8" \
Expand All @@ -24,22 +25,34 @@ RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86
sudo apt update && \
sudo apt -y install cuda-toolkit-12-6 cudnn9-cuda-12

# OpenCV Build Stage
FROM base AS opencv_build

# OpenCV 4.10.0 install
COPY build_opencv.sh /tmp/build_opencv.sh
RUN bash /tmp/build_opencv.sh
COPY .devcontainer/build_opencv.sh /tmp/build_opencv.sh
RUN bash /tmp/build_opencv.sh && rm -rf /tmp/build_opencv.sh

# Final Stage: Combine ROS, CUDA, and OpenCV
FROM base AS final

# Copy OpenCV installation from the build stage
COPY --from=opencv_build /usr/local /usr/local

# Git-prompt: Source
RUN echo 'if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then GIT_PROMPT_ONLY_IN_REPO=1; source "$HOME/.bash-git-prompt/gitprompt.sh"; fi' >> /home/asl/.bash_aliases

# ROS: Source
RUN echo "source /opt/ros/noetic/setup.bash" >> /home/asl/.bash_aliases

# ROS: rosdep init
RUN sudo rosdep init && \
rosdep update && \
rosdep install --from-paths . --ignore-src -r -y
# ROS: rosdep install (TODO: maybe not so clean?)
RUN sudo rosdep init
USER asl
RUN rosdep update
COPY package.xml /tmp/
RUN rosdep install --from-paths /tmp/ --ignore-src -r -y -v
USER root

# Clean up
RUN rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /var/cache/apt/archives/*

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/bin/bash"]
2 changes: 1 addition & 1 deletion .devcontainer/build_and_push_images.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker buildx build -t omavteam/v4l2_camera:latest -f .devcontainer/Dockerfile --push
docker buildx build -t omavteam/v4l2_camera:latest -f .devcontainer/Dockerfile --push .
9 changes: 4 additions & 5 deletions .devcontainer/build_opencv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,14 @@ configure() {

local CMAKEFLAGS="
-D BUILD_EXAMPLES=OFF
-D BUILD_opencv_python2=ON
-D BUILD_opencv_python3=ON
-D BUILD_opencv_python2=OFF
-D BUILD_opencv_python3=OFF
-D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=${PREFIX}
-D CUDA_ARCH_BIN=${CUDA_ARCH_BIN}
-D CUDA_ARCH_PTX=
-D CUDA_FAST_MATH=ON
-D CUDNN_VERSION='${CUDNN_VERSION}'
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3
-D ENABLE_NEON=OFF
-D OPENCV_DNN_CUDA=ON
-D OPENCV_ENABLE_NONFREE=ON
Expand Down Expand Up @@ -202,7 +201,7 @@ main () {

# prepare for the build:
setup
install_dependencies
# install_dependencies
# if [[ ! -d "$BUILD_DIR/build_opencv" ]] ; then
git_source ${VER}
# fi
Expand Down
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer_all_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,51 @@ main() {
build-essential
ca-certificates
ccache
cmake
curl
gfortran
git
gnupg
htop
libatlas-base-dev
libavcodec-dev
libavformat-dev
libavresample-dev
libcanberra-gtk3-module
libdc1394-22-dev
libeigen3-dev
libglew-dev
libgstreamer-plugins-base1.0-dev
libgstreamer-plugins-good1.0-dev
libgstreamer1.0-dev
libgtk-3-dev
libjpeg-dev
libjpeg-turbo8-dev
libjpeg8-dev
liblapack-dev
liblapacke-dev
libopenblas-dev
libpng-dev
libpostproc-dev
libswscale-dev
libtbb-dev
libtbb2
libtesseract-dev
libtiff-dev
libv4l-dev
libx264-dev
libxine2-dev
libxvidcore-dev
locales
net-tools
pkg-config
python-dev
python-numpy
python3-dev
python3-matplotlib
python3-numpy
python3-rosdep
qv4l2
software-properties-common
ssh
sudo
Expand All @@ -24,6 +63,7 @@ main() {
vim
wget
zlib1g
zlib1g-dev
)

apt-get update
Expand Down

0 comments on commit 0922c05

Please sign in to comment.