Switched to two step complete ci build (on one branch)

This commit is contained in:
Maximilian Kratz 2021-04-24 19:09:21 +02:00
parent 4a092e54b2
commit 641f10e424
4 changed files with 72 additions and 41 deletions

View file

@ -1,16 +1,34 @@
kind: pipeline
name: default
auth: &auth
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
repo: &repo
repo: maxkratz/ros2dashing
steps:
- name: docker
- name: build-latest
image: plugins/docker
settings:
repo: maxkratz/ros2dashing
tags: opencv
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
<<: *repo
tags: latest
<<: *auth
when:
branch:
- opencv
- master
- name: build-opencv
image: plugins/docker
settings:
dockerfile: opencv/Dockerfile
<<: *repo
tags: opencv
<<: *auth
when:
branch:
- master
depends_on: [ build-latest ]

View file

@ -86,39 +86,6 @@ RUN cp *.a /usr/lib
# Install clang-format (https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
RUN apt install -y clang-format
# Install related packages for Intel RealSense (based on https://github.com/intel/ros2_intel_realsense)
RUN apt-get update
RUN apt-get install -y ros-dashing-cv-bridge ros-dashing-librealsense2 ros-dashing-message-filters ros-dashing-image-transport
RUN apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
RUN apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
RUN apt-get install -y ros-dashing-realsense-camera-msgs ros-dashing-realsense-ros2-camera
# Install opencv (based on https://linuxize.com/post/how-to-install-opencv-on-ubuntu-18-04/)
#RUN sudo apt install python3-opencv # this is not the recommend way
# Increase git repo buffer size (for cloning opencv via https)
# (based on https://stackoverflow.com/questions/15240815/git-fatal-the-remote-end-hung-up-unexpectedly)
RUN git config --global http.postBuffer 524288000
# Recommend install way for opencv
WORKDIR /root
RUN mkdir opencv_build
WORKDIR /root/opencv_build
RUN git clone https://github.com/opencv/opencv.git
RUN git clone https://github.com/opencv/opencv_contrib.git
WORKDIR /root/opencv_build/opencv
RUN mkdir build
WORKDIR /root/opencv_build/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
RUN make -j $(nproc)
RUN make install
# Reset workdir to home-folder
WORKDIR /root

View file

@ -32,6 +32,7 @@ Various packages are installed in this docker container:
* [googletest-suite](https://github.com/google/googletest) (built from source)
* [clang-format](https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
* [opencv](https://opencv.org/) (built from source)
* Only available with tag `opencv`.
* [intel-realsense packages](https://github.com/intel/ros2_intel_realsense)

45
opencv/Dockerfile Normal file
View file

@ -0,0 +1,45 @@
# Use ros2dashing:latest as base
FROM maxkratz/ros2dashing:latest
LABEL maintainer="Max Kratz <account@maxkratz.com>"
ENV DEBIAN_FRONTEND=noninteractive
# Install related packages for Intel RealSense (based on https://github.com/intel/ros2_intel_realsense)
RUN apt-get update
RUN apt-get install -y ros-dashing-cv-bridge ros-dashing-librealsense2 ros-dashing-message-filters ros-dashing-image-transport
RUN apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
RUN apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
RUN apt-get install -y ros-dashing-realsense-camera-msgs ros-dashing-realsense-ros2-camera
# Increase git repo buffer size (for cloning opencv via https)
# (based on https://stackoverflow.com/questions/15240815/git-fatal-the-remote-end-hung-up-unexpectedly)
RUN git config --global http.postBuffer 524288000
# Recommend install way for opencv
WORKDIR /root
RUN mkdir opencv_build
WORKDIR /root/opencv_build
RUN git clone https://github.com/opencv/opencv.git
RUN git clone https://github.com/opencv/opencv_contrib.git
WORKDIR /root/opencv_build/opencv
RUN mkdir build
WORKDIR /root/opencv_build/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
RUN make -j $(nproc)
RUN make install
# Reset workdir to home-folder
WORKDIR /root
# Source again
RUN /bin/bash -c "source /opt/ros/dashing/setup.bash"
# Remove apt lists (for storage efficiency)
RUN rm -rf /var/lib/apt/lists/*
CMD ["bash"]