Skip to content

Commit

Permalink
Merge pull request #49 from hsp-iit/feature/fix_docker_images
Browse files Browse the repository at this point in the history
Yarp dependencies fixed - Yarp branch as Dockerfile arg
  • Loading branch information
elandini84 authored Jan 17, 2024
2 parents a1b8750 + 9180096 commit 335f7c1
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 18 deletions.
1 change: 1 addition & 0 deletions docker_stuff/docker_mng_vars.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
UBUNTU_DEF="ubuntu:22.04"
CUDA_DEF="nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04"
ROS_DEF="iron"
YARP_DEF="master"
CUDA_SUFFIX="cuda.11.7.1-cudnn8"
UBUNTU_SUFFIX="ubuntu22.04"
DEVEL_SUFFIX="devel"
Expand Down
15 changes: 10 additions & 5 deletions docker_stuff/docker_openPose/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8

# Install yarp dependencies
RUN echo "deb http://www.icub.org/ubuntu `lsb_release -cs` contrib/science" > /etc/apt/sources.list.d/icub.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 57A5ACB6110576A6
RUN apt-get update && apt-get install -y icub-common libopencv-dev && sudo rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libode8 libace-dev libboost-filesystem-dev libboost-system-dev \
libboost-thread-dev libc6 python3 libgsl0-dev libncurses5-dev libsdl1.2-dev subversion git gfortran \
libxmu-dev libode-dev wget unzip qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev libqt5svg5 \
libqt5opengl5-dev libopencv-dev freeglut3-dev libtinyxml-dev libblas-dev coinor-libipopt-dev \
liblapack-dev libmumps-dev qml-module-qtmultimedia qml-module-qtquick-dialogs qml-module-qtquick-controls \
qml-module-qt-labs-settings libqcustomplot-dev qml-module-qt-labs-folderlistmodel libedit-dev \
libeigen3-dev libjpeg-dev libsimbody-dev libxml2-dev libjs-underscore portaudio19-dev libgtkmm-2.4-dev \
libi2c-dev libv4l-dev

# Create user: user1
USER root
Expand All @@ -53,7 +58,7 @@ RUN git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose && \
RUN cd $user1_home/openpose && \
mkdir build && \
cd ./build && \
# Right now the following does not work.
# Right now the following does not work.
# https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/2233
# You have to download the weights manually
# cmake .. -DDOWNLOAD_HAND_MODEL=OFF -DUSE_CUDNN=OFF && \
Expand All @@ -75,7 +80,7 @@ ENV YCM_DIR=/home/user1/robotology/ycm/build
# Build YARP
USER $robotology_install_user
WORKDIR $robotology_install_folder
RUN git clone https://github.com/robotology/yarp.git -b master
RUN git clone https://github.com/robotology/yarp.git -b yarp-3.9
RUN cd yarp && mkdir build && cd build && \
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
16 changes: 11 additions & 5 deletions docker_stuff/docker_sim2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ FROM $base_img
LABEL maintainer="Ettore Landini"

ARG ros_distro
ARG yarp_branch="master"

# Non-interactive installation mode
ENV DEBIAN_FRONTEND=noninteractive
ENV DOCKER_UPDATED_ON=28_09_2022

# Install essentials
RUN apt-get update && apt-get install -y apt-utils software-properties-common sudo psmisc lsb-release \
RUN apt-get update && apt-get install -y apt software-properties-common sudo psmisc lsb-release \
tmux nano geany vim wget curl build-essential git gitk cmake cmake-curses-gui autoconf xserver-xorg-video-dummy xserver-xorg-legacy \
net-tools terminator libjpeg-dev ffmpeg apt-transport-https ca-certificates gnupg libace-dev ycm-cmake-modules locales \
python3-setuptools python3-pip iproute2 python3-tornado swig lsof iftop iputils-ping gdb bash-completion btop mlocate && rm -rf /var/lib/apt/lists/*
Expand All @@ -33,9 +34,14 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y ros-$ros_distro-d
python3-pytest-rerunfailures python3-rosdep python3-vcstool && rosdep init && rm -rf /var/lib/apt/lists/*

# Install yarp dependencies
RUN echo "deb http://www.icub.org/ubuntu `lsb_release -cs` contrib/science" > /etc/apt/sources.list.d/icub.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 57A5ACB6110576A6
RUN apt-get update && apt-get install -y icub-common libopencv-dev && sudo rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libode8 libace-dev libboost-filesystem-dev libboost-system-dev \
libboost-thread-dev libc6 python3 libgsl0-dev libncurses5-dev libsdl1.2-dev subversion git gfortran \
libxmu-dev libode-dev wget unzip qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev libqt5svg5 \
libqt5opengl5-dev libopencv-dev freeglut3-dev libtinyxml-dev libblas-dev coinor-libipopt-dev \
liblapack-dev libmumps-dev qml-module-qtmultimedia qml-module-qtquick-dialogs qml-module-qtquick-controls \
qml-module-qt-labs-settings libqcustomplot-dev qml-module-qt-labs-folderlistmodel libedit-dev \
libeigen3-dev libjpeg-dev libsimbody-dev libxml2-dev libjs-underscore portaudio19-dev libgtkmm-2.4-dev \
libi2c-dev libv4l-dev

# Create user: user1
USER root
Expand Down Expand Up @@ -70,7 +76,7 @@ ENV YCM_DIR=/home/user1/robotology/ycm/build
# Build YARP
USER $robotology_install_user
WORKDIR $robotology_install_folder
RUN git clone https://github.com/robotology/yarp.git -b master
RUN git clone https://github.com/robotology/yarp.git -b $yarp_branch
RUN cd yarp && mkdir build && cd build && \
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
23 changes: 21 additions & 2 deletions docker_stuff/docker_sim2/manage-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ usage()
echo " -d, --devel Build/run the image with the '$DEVEL_SUFFIX' tag"
echo " -e, --repo + \"repo_name\" Build/run the image with the passed repository reference"
echo " -r, --ros_distro + \"distro_name\" Build/run the image with the passed distro (the passed value will be also used to compose the image tag)"
echo " -y, --yarp_branch + \"yarp branch\" Build/run the image with the passed yarp branch (the passed value, if different from \"master\", will be also used to compose the image tag)."
echo " If not passed, the branch used will be \"master\""
echo " -h, --help See current help"
echo "If the parent image is not specified (neither -u nor -c), the '$UBUNTU_DEF' one will be used"
echo "If the build type is not specified (neither -d nor -s), the '$DEVEL_SUFFIX' tag will be used"
Expand Down Expand Up @@ -86,6 +88,16 @@ get_opts()
ROS_SET=true
shift
;;
-y|--yarp_vers)
if [[ $YARP_SET == "true" ]]; then
echo "YARP branch already set already set"
usage
fi
shift
YARP_BRANCH=$1
YARP_SET=true
shift
;;
-e|--repository)
if [[ $REPO_SET == "true" ]]; then
echo "Remote repository already set"
Expand Down Expand Up @@ -132,12 +144,14 @@ BASE_TAG_DEF="tourSim2"
BUILD_SUFFIX=$DEVEL_SUFFIX
VERSION="1.0.0"
ROS_DISTRO=$ROS_DEF
YARP_BRANCH=$YARP_DEF
PARENT_SUFFIX=$UBUNTU_SUFFIX
IMAGE_SET=false
BUILD_SET=false
GONNA_BUILD=false
RUN_WITH_GPU=true
ROS_SET=false
YARP_SET=false
IMAGE=$UBUNTU_DEF
REPO=$REPO_DEF
REPO_SET=false
Expand All @@ -149,10 +163,15 @@ BASE_TAG=$BASE_TAG_DEF
# Get the options
get_opts $@

COMPLETE_IMAGE_NAME=$REPO$REPO_SEP$BASE_TAG$JUNCTION$PARENT_SUFFIX$JUNCTION$ROS_DISTRO$JUNCTION$BUILD_SUFFIX
if [[ $YARP_BRANCH != "master" ]]; then
YARP_TAG=$YARP_BRANCH$JUNCTION
fi
COMPLETE_IMAGE_NAME=$REPO$REPO_SEP$BASE_TAG$JUNCTION$PARENT_SUFFIX$JUNCTION$ROS_DISTRO$JUNCTION$YARP_TAG$BUILD_SUFFIX

echo $COMPLETE_IMAGE_NAME

if [[ $GONNA_BUILD == "true" ]]; then
sudo docker build --build-arg base_img=$IMAGE --build-arg ros_distro=$ROS_DISTRO -t $COMPLETE_IMAGE_NAME .
sudo docker build --build-arg base_img=$IMAGE --build-arg ros_distro=$ROS_DISTRO --build-arg yarp_branch=$YARP_BRANCH -t $COMPLETE_IMAGE_NAME .
else
sudo xhost +
if [[ $RUN_WITH_GPU == "true" ]]; then
Expand Down
14 changes: 10 additions & 4 deletions docker_stuff/docker_tourCore2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM $base_img
LABEL maintainer="Ettore Landini"

ARG ros_distro
ARG yarp_branch="master"

# Non-interactive installation mode
ENV DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -33,9 +34,14 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y ros-$ros_distro-d
python3-pytest-rerunfailures python3-rosdep python3-vcstool && rosdep init && rm -rf /var/lib/apt/lists/*

# Install yarp dependencies
RUN echo "deb http://www.icub.org/ubuntu `lsb_release -cs` contrib/science" > /etc/apt/sources.list.d/icub.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 57A5ACB6110576A6
RUN apt-get update && apt-get install -y icub-common libopencv-dev && sudo rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libode8 libace-dev libboost-filesystem-dev libboost-system-dev \
libboost-thread-dev libc6 python3 libgsl0-dev libncurses5-dev libsdl1.2-dev subversion git gfortran \
libxmu-dev libode-dev wget unzip qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev libqt5svg5 \
libqt5opengl5-dev libopencv-dev freeglut3-dev libtinyxml-dev libblas-dev coinor-libipopt-dev \
liblapack-dev libmumps-dev qml-module-qtmultimedia qml-module-qtquick-dialogs qml-module-qtquick-controls \
qml-module-qt-labs-settings libqcustomplot-dev qml-module-qt-labs-folderlistmodel libedit-dev \
libeigen3-dev libjpeg-dev libsimbody-dev libxml2-dev libjs-underscore portaudio19-dev libgtkmm-2.4-dev \
libi2c-dev libv4l-dev

# Create user: user1
USER root
Expand Down Expand Up @@ -67,7 +73,7 @@ ENV YCM_DIR=/home/user1/robotology/ycm/build
# Build YARP
USER $robotology_install_user
WORKDIR $robotology_install_folder
RUN git clone https://github.com/robotology/yarp.git -b master
RUN git clone https://github.com/robotology/yarp.git -b ${yarp_branch}
RUN cd yarp && mkdir build && cd build && \
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
22 changes: 20 additions & 2 deletions docker_stuff/docker_tourCore2/manage-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ usage()
echo " -d, --devel Build/run the image with the '$DEVEL_SUFFIX' tag"
echo " -e, --repo + \"repo_name\" Build/run the image with the passed repository reference"
echo " -r, --ros_distro + \"distro_name\" Build/run the image with the passed distro (the passed value will be also used to compose the image tag)"
echo " -y, --yarp_branch + \"yarp branch\" Build/run the image with the passed yarp branch (the passed value, if different from \"master\", will be also used to compose the image tag)."
echo " If not passed, the branch used will be \"master\""
echo " -h, --help See current help"
echo "If the parent image is not specified (neither -u nor -c), the '$UBUNTU_DEF' one will be used"
echo "If the build type is not specified (neither -d nor -s), the '$DEVEL_SUFFIX' tag will be used"
Expand Down Expand Up @@ -86,6 +88,16 @@ get_opts()
ROS_SET=true
shift
;;
-y|--yarp_vers)
if [[ $YARP_SET == "true" ]]; then
echo "YARP branch already set already set"
usage
fi
shift
YARP_BRANCH=$1
YARP_SET=true
shift
;;
-e|--repository)
if [[ $REPO_SET == "true" ]]; then
echo "Remote repository already set"
Expand Down Expand Up @@ -132,12 +144,15 @@ BASE_TAG_DEF="tourCore2"
BUILD_SUFFIX=$DEVEL_SUFFIX
VERSION="1.0.0"
ROS_DISTRO=$ROS_DEF
YARP_BRANCH=$YARP_DEF
YARP_TAG=""
PARENT_SUFFIX=$UBUNTU_SUFFIX
IMAGE_SET=false
BUILD_SET=false
GONNA_BUILD=false
RUN_WITH_GPU=true
ROS_SET=false
YARP_SET=false
IMAGE=$UBUNTU_DEF
REPO=$REPO_DEF
REPO_SET=false
Expand All @@ -149,10 +164,13 @@ BASE_TAG=$BASE_TAG_DEF
# Get the options
get_opts $@

COMPLETE_IMAGE_NAME=$REPO$REPO_SEP$BASE_TAG$JUNCTION$PARENT_SUFFIX$JUNCTION$ROS_DISTRO$JUNCTION$BUILD_SUFFIX
if [[ $YARP_BRANCH != "master" ]]; then
YARP_TAG=$YARP_BRANCH$JUNCTION
fi
COMPLETE_IMAGE_NAME=$REPO$REPO_SEP$BASE_TAG$JUNCTION$PARENT_SUFFIX$JUNCTION$ROS_DISTRO$JUNCTION$YARP_TAG$BUILD_SUFFIX

if [[ $GONNA_BUILD == "true" ]]; then
sudo docker build --build-arg base_img=$IMAGE --build-arg ros_distro=$ROS_DISTRO -t $COMPLETE_IMAGE_NAME .
sudo docker build --build-arg base_img=$IMAGE --build-arg ros_distro=$ROS_DISTRO --build-arg yarp_branch=$YARP_BRANCH -t $COMPLETE_IMAGE_NAME .
else
sudo xhost +
if [[ $RUN_WITH_GPU == "true" ]]; then
Expand Down

0 comments on commit 335f7c1

Please sign in to comment.