diff --git a/doc/010_Setup_Docker.md b/doc/010_Setup_Docker.md index 2771d44..e9a94ce 100644 --- a/doc/010_Setup_Docker.md +++ b/doc/010_Setup_Docker.md @@ -92,6 +92,24 @@ In order to make sure that the kernel modules are properly loaded, you should re Now you are ready to use docker! +### Cross Development for docker images + +To develop for arm-based boards on x86, you can enable your host machine execute non-native binary formats using [QEMU](https://www.qemu.org) and [binfmt_misc](https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html). + +When this is set up, docker is able to run images for the architectures supported by QEMU on your host machine (using CPU emulation). + +There is a docker image that can do the settings for you: [see here](https://github.com/multiarch/qemu-user-static) + +Quick enable: + + sudo apt-get install qemu binfmt-support qemu-user-static + sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes + +Test it using e.g. + + docker run --rm -ti arm64v8/ubuntu uname -m + + ### Using a registry If you want to use the image generated by the docker build from this repository, you can also use the already build image from the registry server. diff --git a/docker_commands.bash b/docker_commands.bash index 30c062f..35cba87 100755 --- a/docker_commands.bash +++ b/docker_commands.bash @@ -22,7 +22,7 @@ init_docker(){ touch $GPUS_SETTINGS_FILE docker run --gpus=all --rm $IMAGE_NAME > /dev/null GPU_SUPPORTED=$? - echo "this file contains the gegerated result of testing the docker --gpu setting, 0=enabled, 1=disabled" > $GPUS_SETTINGS_FILE + echo "this file contains the generated result of testing the docker --gpu setting, 0=enabled, 1=disabled" > $GPUS_SETTINGS_FILE echo $GPU_SUPPORTED >> $GPUS_SETTINGS_FILE fi HAS_GPU_SUPPORT=$(tail -n1 $GPUS_SETTINGS_FILE) diff --git a/exec.bash b/exec.bash index 2cb0063..824987a 100755 --- a/exec.bash +++ b/exec.bash @@ -98,7 +98,7 @@ DOCKER_RUN_ARGS=" \ --name $CONTAINER_NAME \ -e NUID=$(id -u) -e NGID=$(id -g) \ -u devel \ - --dns $DNSIP \ + ${DNSIP:+--dns $DNSIP} \ -e DISPLAY -e QT_X11_NO_MITSHM=1 -v /tmp/.X11-unix:/tmp/.X11-unix \ $ADDITIONAL_DOCKER_RUN_ARGS \ $ADDITIONAL_DOCKER_MOUNT_ARGS \ diff --git a/image_setup/01_base_images/Dockerfile b/image_setup/01_base_images/Dockerfile index b72f8c8..071989e 100644 --- a/image_setup/01_base_images/Dockerfile +++ b/image_setup/01_base_images/Dockerfile @@ -14,16 +14,15 @@ ENV DEBIAN_FRONTEND=noninteractive # general requirements RUN apt-get update && apt-get install -y \ - build-essential \ apt-utils \ - git \ - wget \ - cmake \ - sudo \ + build-essential \ cmake \ + git \ + locales \ python3 \ python3-dev \ - locales + sudo \ + wget RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 @@ -39,13 +38,13 @@ RUN /opt/install.bash ${INSTALL_ARGS} ADD init_user_id.bash /opt/init_user_id.bash -# create user (usermod -u UID username will be used later to maybe adapt UID on fitst start). +# create user (usermod -u UID username will be used later to maybe adapt UID on first start). # using salted password: openssl passwd -1 -salt xyz yourpass # pw UserRos # RUN useradd -m -U -p '$1$xyz$pzVfEx0ZWLPizymvlx2P70' -G sudo,users rosuser RUN groupadd devel-group RUN useradd --shell /bin/bash -c "development user" -m -G devel-group devel -# set user sudoers previlege for start script (w/o password), the /opt/init_user_id.bash script +# set user sudoers privilege for start script (w/o password), the /opt/init_user_id.bash script # is using NUID and NGID environment variables, but ist executed by the user using sudo, so these vars have to be kept RUN echo "devel ALL=(ALL) NOPASSWD: ALL \ \nDefaults env_keep += \"NUID\" \ diff --git a/image_setup/01_base_images/arm32v7/install_ros_dependencies.bash b/image_setup/01_base_images/arm32v7/install_ros_dependencies.bash new file mode 100644 index 0000000..4043c30 --- /dev/null +++ b/image_setup/01_base_images/arm32v7/install_ros_dependencies.bash @@ -0,0 +1,28 @@ +#!/bin/bash + +#install ROS melodic (second install because needs gnupg) +export DEBIAN_FRONTEND=noninteractive + +DISTRO=${1:-melodic} +[ $DISTRO == "noetic" ] && export vPYTHON=3 + +apt-get update && apt-get install -y \ + lsb-release \ + gnupg2 \ + gosu \ + ruby \ + ruby-dev \ + python$vPYTHON + +sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +apt-get update && apt-get install -y \ + ros-desktop \ + python$vPYTHON-catkin-pkg \ + python$vPYTHON-rosdep2 \ + python$vPYTHON-rosinstall \ + python$vPYTHON-rosinstall-generator \ + python$vPYTHON-wstool + + +#rosdep init && rosdep update diff --git a/image_setup/01_base_images/arm32v7/install_ros_minimal_dependencies.bash b/image_setup/01_base_images/arm32v7/install_ros_minimal_dependencies.bash new file mode 100644 index 0000000..92cb00b --- /dev/null +++ b/image_setup/01_base_images/arm32v7/install_ros_minimal_dependencies.bash @@ -0,0 +1,30 @@ +#!/bin/bash + +#install ROS melodic (second install because needs gnupg) +export DEBIAN_FRONTEND=noninteractive + +DISTRO=${1:-melodic} +[ $DISTRO == "noetic" ] && export vPYTHON=3 + +apt-get update && apt-get install -y \ + lsb-release \ + gnupg2 \ + gosu \ + ruby \ + ruby-dev \ + python$vPYTHON + +sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +apt-get update && apt-get install -y \ + ros-base \ + python$vPYTHON-catkin-pkg \ + python$vPYTHON-rosdep2 \ + python$vPYTHON-rosinstall \ + python$vPYTHON-rosinstall-generator \ + python$vPYTHON-wstool + + +#rosdep init && rosdep update + + diff --git a/image_setup/01_base_images/arm64v8/install_ros_dependencies.bash b/image_setup/01_base_images/arm64v8/install_ros_dependencies.bash new file mode 100644 index 0000000..4043c30 --- /dev/null +++ b/image_setup/01_base_images/arm64v8/install_ros_dependencies.bash @@ -0,0 +1,28 @@ +#!/bin/bash + +#install ROS melodic (second install because needs gnupg) +export DEBIAN_FRONTEND=noninteractive + +DISTRO=${1:-melodic} +[ $DISTRO == "noetic" ] && export vPYTHON=3 + +apt-get update && apt-get install -y \ + lsb-release \ + gnupg2 \ + gosu \ + ruby \ + ruby-dev \ + python$vPYTHON + +sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +apt-get update && apt-get install -y \ + ros-desktop \ + python$vPYTHON-catkin-pkg \ + python$vPYTHON-rosdep2 \ + python$vPYTHON-rosinstall \ + python$vPYTHON-rosinstall-generator \ + python$vPYTHON-wstool + + +#rosdep init && rosdep update diff --git a/image_setup/01_base_images/arm64v8/install_ros_minimal_dependencies.bash b/image_setup/01_base_images/arm64v8/install_ros_minimal_dependencies.bash new file mode 100644 index 0000000..71aa20e --- /dev/null +++ b/image_setup/01_base_images/arm64v8/install_ros_minimal_dependencies.bash @@ -0,0 +1,28 @@ +#!/bin/bash + +#install ROS melodic (second install because needs gnupg) +export DEBIAN_FRONTEND=noninteractive + +DISTRO=${1:-melodic} +[ $DISTRO == "noetic" ] && export vPYTHON=3 + +apt-get update && apt-get install -y \ + lsb-release \ + gnupg2 \ + gosu \ + ruby \ + ruby-dev \ + python$vPYTHON + +sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +apt-get update && apt-get install -y \ + ros-base \ + python$vPYTHON-catkin-pkg \ + python$vPYTHON-rosdep2 \ + python$vPYTHON-rosinstall \ + python$vPYTHON-rosinstall-generator \ + python$vPYTHON-wstool + + +#rosdep init && rosdep update diff --git a/image_setup/01_base_images/build_plain_18.04.bash b/image_setup/01_base_images/build_plain_18.04.bash index 6b01678..b29abfc 100755 --- a/image_setup/01_base_images/build_plain_18.04.bash +++ b/image_setup/01_base_images/build_plain_18.04.bash @@ -1,16 +1,22 @@ #!/bin/bash . ../../settings.bash -export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/plain_18.04 -export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04 -export INSTALL_SCRIPT=install_plain_dependencies.bash +# manage base image name depending on selected $ARCH in settings.bash +if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then + export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04 + echo "Building for x86_64 processor. Using $BASE_IMAGE as base image." +else + export BASE_IMAGE=$ARCH/ubuntu:bionic + echo "Building for $ARCH processor. Using $BASE_IMAGE as base image." +fi + +export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}plain_18.04 +export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_plain_dependencies.bash docker pull $BASE_IMAGE docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT . - - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME:base" diff --git a/image_setup/01_base_images/build_plain_20.04.bash b/image_setup/01_base_images/build_plain_20.04.bash index 52ae381..339a363 100755 --- a/image_setup/01_base_images/build_plain_20.04.bash +++ b/image_setup/01_base_images/build_plain_20.04.bash @@ -1,16 +1,22 @@ #!/bin/bash . ../../settings.bash -export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/plain_20.04 -export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu20.04 -export INSTALL_SCRIPT=install_plain_dependencies.bash +# manage base image name depending on selected $ARCH in settings.bash +if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then + export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu20.04 + echo "Building for x86_64 processor. Using $BASE_IMAGE as base image." +else + export BASE_IMAGE=$ARCH/ubuntu:focal + echo "Building for $ARCH processor. Using $BASE_IMAGE as base image." +fi + +export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}plain_20.04 +export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_plain_dependencies.bash docker pull $BASE_IMAGE docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT . - - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME:base" diff --git a/image_setup/01_base_images/build_rock_master_16.04.bash b/image_setup/01_base_images/build_rock_master_16.04.bash index c6f20e2..6391f16 100755 --- a/image_setup/01_base_images/build_rock_master_16.04.bash +++ b/image_setup/01_base_images/build_rock_master_16.04.bash @@ -1,16 +1,22 @@ #!/bin/bash . ../../settings.bash -export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/rock_master_16.04 -export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu16.04 -export INSTALL_SCRIPT=install_rock_dependencies.bash +# manage base image name depending on selected $ARCH in settings.bash +if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then + export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu16.04 + echo "Building for x86_64 processor. Using $BASE_IMAGE as base image." +else + export BASE_IMAGE=$ARCH/ubuntu:xenial + echo "Building for $ARCH processor. Using $BASE_IMAGE as base image." +fi + +export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}rock_master_16.04 +export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_rock_dependencies.bash docker pull $BASE_IMAGE docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT . - - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME:base" diff --git a/image_setup/01_base_images/build_rock_master_18.04.bash b/image_setup/01_base_images/build_rock_master_18.04.bash index 7a63c6b..f59bcba 100755 --- a/image_setup/01_base_images/build_rock_master_18.04.bash +++ b/image_setup/01_base_images/build_rock_master_18.04.bash @@ -1,16 +1,22 @@ #!/bin/bash . ../../settings.bash -export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/rock_master_18.04 -export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04 -export INSTALL_SCRIPT=install_rock_dependencies.bash +# manage base image name depending on selected $ARCH in settings.bash +if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then + export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04 + echo "Building for x86_64 processor. Using $BASE_IMAGE as base image." +else + export BASE_IMAGE=$ARCH/ubuntu:bionic + echo "Building for $ARCH processor. Using $BASE_IMAGE as base image." +fi + +export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}rock_master_18.04 +export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_rock_dependencies.bash docker pull $BASE_IMAGE docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT . - - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME:base" diff --git a/image_setup/01_base_images/build_ros_melodic_18.04.bash b/image_setup/01_base_images/build_ros_melodic_18.04.bash index aad4b6e..f8ed5f8 100755 --- a/image_setup/01_base_images/build_ros_melodic_18.04.bash +++ b/image_setup/01_base_images/build_ros_melodic_18.04.bash @@ -1,18 +1,23 @@ #!/bin/bash . ../../settings.bash -export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/ros_melodic_18.04 -export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04 -export INSTALL_SCRIPT=install_ros_dependencies.bash +# manage base image name depending on selected $ARCH in settings.bash +if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then + export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04 + echo "Building for x86_64 processor. Using $BASE_IMAGE as base image." +else + export BASE_IMAGE=$ARCH/ubuntu:bionic + echo "Building for $ARCH processor. Using $BASE_IMAGE as base image." +fi + +export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}ros_melodic_18.04 +export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_ros_dependencies.bash docker pull $BASE_IMAGE docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT . - - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME:base" echo - diff --git a/image_setup/01_base_images/build_ros_melodic_18.04_minimal.bash b/image_setup/01_base_images/build_ros_melodic_18.04_minimal.bash index 47d4d6b..d75b1a7 100755 --- a/image_setup/01_base_images/build_ros_melodic_18.04_minimal.bash +++ b/image_setup/01_base_images/build_ros_melodic_18.04_minimal.bash @@ -1,18 +1,23 @@ #!/bin/bash . ../../settings.bash -export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/ros_melodic_18.04_minimal -export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04 -export INSTALL_SCRIPT=install_ros_minimal_dependencies.bash +# manage base image name depending on selected $ARCH in settings.bash +if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then + export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu18.04 + echo "Building for x86_64 processor. Using $BASE_IMAGE as base image." +else + export BASE_IMAGE=$ARCH/ubuntu:bionic + echo "Building for $ARCH processor. Using $BASE_IMAGE as base image." +fi + +export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}ros_melodic_18.04_minimal +export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_ros_minimal_dependencies.bash docker pull $BASE_IMAGE docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT . - - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME:base" echo - diff --git a/image_setup/01_base_images/build_ros_noetic_20.04.bash b/image_setup/01_base_images/build_ros_noetic_20.04.bash index 7d5ea25..7c7430e 100755 --- a/image_setup/01_base_images/build_ros_noetic_20.04.bash +++ b/image_setup/01_base_images/build_ros_noetic_20.04.bash @@ -1,19 +1,24 @@ #!/bin/bash . ../../settings.bash -export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/ros_noetic_20.04 -export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu20.04 -export INSTALL_SCRIPT=install_ros_dependencies.bash +# manage base image name depending on selected $ARCH in settings.bash +if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then + export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu20.04 + echo "Building for x86_64 processor. Using $BASE_IMAGE as base image." +else + export BASE_IMAGE=$ARCH/ubuntu:focal + echo "Building for $ARCH processor. Using $BASE_IMAGE as base image." +fi + +export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}ros_noetic_20.04 +export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_ros_dependencies.bash export INSTALL_ARGS=noetic docker pull $BASE_IMAGE docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT --build-arg INSTALL_ARGS . - - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME:base" echo - diff --git a/image_setup/01_base_images/build_ros_noetic_20.04_minimal.bash b/image_setup/01_base_images/build_ros_noetic_20.04_minimal.bash index 8221e9d..25f830a 100755 --- a/image_setup/01_base_images/build_ros_noetic_20.04_minimal.bash +++ b/image_setup/01_base_images/build_ros_noetic_20.04_minimal.bash @@ -1,19 +1,24 @@ #!/bin/bash . ../../settings.bash -export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/ros_noetic_20.04_minimal -export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu20.04 -export INSTALL_SCRIPT=install_ros_minimal_dependencies.bash +# manage base image name depending on selected $ARCH in settings.bash +if [ "$ARCH" == "" ] || [ "$ARCH" == "x86_64" ]; then + export BASE_IMAGE=nvidia/opengl:1.0-glvnd-devel-ubuntu20.04 + echo "Building for x86_64 processor. Using $BASE_IMAGE as base image." +else + export BASE_IMAGE=$ARCH/ubuntu:focal + echo "Building for $ARCH processor. Using $BASE_IMAGE as base image." +fi + +export IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}developmentimage/${ARCH:+$ARCH/}ros_noetic_20.04_minimal +export INSTALL_SCRIPT=${ARCH:+$ARCH/}install_ros_minimal_dependencies.bash export INSTALL_ARGS=noetic docker pull $BASE_IMAGE docker build --no-cache -f Dockerfile -t $IMAGE_NAME:base --build-arg BASE_IMAGE --build-arg INSTALL_SCRIPT --build-arg INSTALL_ARGS . - - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME:base" echo - diff --git a/image_setup/01_base_images/install_plain_dependencies.bash b/image_setup/01_base_images/install_plain_dependencies.bash index c708786..fb43b93 100644 --- a/image_setup/01_base_images/install_plain_dependencies.bash +++ b/image_setup/01_base_images/install_plain_dependencies.bash @@ -1,15 +1,4 @@ #!/bin/bash -#install ROS melodic (second install because needs gnupg) -export DEBIAN_FRONTEND=noninteractive - -# apt-get update && apt-get install -y \ -# lsb-release \ -# gnupg2 \ -# gosu \ -# ruby \ -# ruby-dev \ -# python - - - +# this script remains empty for now as all essential packages +# for the plain base images are listed directly in the Dockerfile diff --git a/image_setup/01_base_images/install_ros_minimal_dependencies.bash b/image_setup/01_base_images/install_ros_minimal_dependencies.bash index f464083..27ed227 100644 --- a/image_setup/01_base_images/install_ros_minimal_dependencies.bash +++ b/image_setup/01_base_images/install_ros_minimal_dependencies.bash @@ -18,11 +18,11 @@ sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > / apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 apt-get update && apt-get install -y \ ros-$DISTRO-ros-base \ + python$vPYTHON-catkin-tools \ + python$vPYTHON-rosdep \ python$vPYTHON-rosinstall \ python$vPYTHON-rosinstall-generator \ - python$vPYTHON-wstool \ - python$vPYTHON-rosdep \ - python$vPYTHON-catkin-tools + python$vPYTHON-wstool #rosdep init && rosdep update diff --git a/image_setup/02_devel_image/Dockerfile b/image_setup/02_devel_image/Dockerfile index 1782ee4..b53d3e4 100644 --- a/image_setup/02_devel_image/Dockerfile +++ b/image_setup/02_devel_image/Dockerfile @@ -20,10 +20,3 @@ RUN echo "echo" >> /opt/init_workspace.bash # If you want to run the setup automatically, you can add it directly to the script # it is executed every time the container is re-created #RUN echo "/opt/setup_workspace.sh" >> /opt/init_workspace.sh - - - - - - - diff --git a/image_setup/02_devel_image/build.bash b/image_setup/02_devel_image/build.bash index bf30c9b..204b302 100644 --- a/image_setup/02_devel_image/build.bash +++ b/image_setup/02_devel_image/build.bash @@ -2,7 +2,6 @@ . ../../settings.bash export BASE_IMAGE_NAME=${BASE_REGISTRY:+${BASE_REGISTRY}/}$WORKSPACE_BASE_IMAGE - IMAGE_NAME=${DEVEL_REGISTRY:+${DEVEL_REGISTRY}/}$WORKSPACE_DEVEL_IMAGE if [ "$DOCKER_REGISTRY_AUTOPULL" = true ]; then @@ -14,7 +13,6 @@ fi docker build --no-cache -f Dockerfile --build-arg BASE_IMAGE_NAME -t $IMAGE_NAME . - echo echo "don't forget to push the image if you wish:" echo "docker push $IMAGE_NAME" diff --git a/image_setup/03_release_image/build.bash b/image_setup/03_release_image/build.bash index 5ebdef7..0a35d4b 100644 --- a/image_setup/03_release_image/build.bash +++ b/image_setup/03_release_image/build.bash @@ -10,16 +10,16 @@ export DEVEL_IMAGE_NAME=${DEVEL_REGISTRY:+${DEVEL_REGISTRY}/}$WORKSPACE_DEVEL_IM #do not pull for release, use the local image, as the release should be based on the exact same devel image #fi -RELEASE_IMAGE_NAME=${RELEASE_REGISTRY:+${RELEASE_REGISTRY}/}$WORKSPACE_RELEASE_IMAGE -echo "Buidling release image: ${RELEASE_IMAGE_NAME}_$TAG by $USER on $HOST Date: $DATE" +IMAGE_NAME=${RELEASE_REGISTRY:+${RELEASE_REGISTRY}/}$WORKSPACE_RELEASE_IMAGE +echo "Buidling release image: ${IMAGE_NAME}_$TAG by $USER on $HOST Date: $DATE" -docker build --no-cache --build-arg DEVEL_IMAGE_NAME --build-arg USER --build-arg HOST --build-arg DATE -f Dockerfile -t $RELEASE_IMAGE_NAME ../.. +docker build --no-cache --build-arg DEVEL_IMAGE_NAME --build-arg USER --build-arg HOST --build-arg DATE -f Dockerfile -t $IMAGE_NAME ../.. -echo "tagging $RELEASE_IMAGE_NAME as ${RELEASE_IMAGE_NAME}_$TAG" -docker tag $RELEASE_IMAGE_NAME ${RELEASE_IMAGE_NAME}_$TAG +echo "tagging $IMAGE_NAME as ${IMAGE_NAME}_$TAG" +docker tag $IMAGE_NAME ${IMAGE_NAME}_$TAG echo echo "don't forget to push the image if you wish:" -echo "docker push $RELEASE_IMAGE_NAME" -echo "docker push ${RELEASE_IMAGE_NAME}_$TAG" +echo "docker push $IMAGE_NAME" +echo "docker push ${IMAGE_NAME}_$TAG" echo diff --git a/image_setup/04_save_release/build.bash b/image_setup/04_save_release/build.bash index 1d25b86..05d384c 100644 --- a/image_setup/04_save_release/build.bash +++ b/image_setup/04_save_release/build.bash @@ -15,7 +15,7 @@ IMAGE_NAME=${RELEASE_REGISTRY:+${RELEASE_REGISTRY}/}$WORKSPACE_RELEASE_IMAGE SCRIPTFOLDER=${PROJECT_NAME_NO_SUBFOLDER}_scripts_${DATE} mkdir -p $SCRIPTFOLDER -#build a scripts zip: +# build a scripts zip: echo "creating scripts archive: $SCRIPTFOLDER.tar.gz" cp ../../docker_commands.bash ./$SCRIPTFOLDER/ cp ../../settings.bash ./$SCRIPTFOLDER/ @@ -30,5 +30,3 @@ rm -rf $SCRIPTFOLDER echo "saving ${IMAGE_NAME} to ${PROJECT_NAME_NO_SUBFOLDER}_image_${DATE}.tar.gz" docker save ${IMAGE_NAME} | gzip > ${PROJECT_NAME_NO_SUBFOLDER}_image_${DATE}.tar.gz - - diff --git a/settings.bash b/settings.bash index 689d779..eb362c9 100755 --- a/settings.bash +++ b/settings.bash @@ -22,20 +22,24 @@ export DEFAULT_EXECMODE="base" # Use this only for setting up the initial devel # export DEFAULT_EXECMODE="devel" # This is used while deveoping code and preparing a relase # export DEFAULT_EXECMODE="release" # use the release as default -### The base image used when building a workspace image (one of the ones build in base_images) -# export WORKSPACE_BASE_IMAGE=developmentimage/rock_master_18.04:base # image with rock core dependencies installed -# export WORKSPACE_BASE_IMAGE=developmentimage/ros_melodic_18.04:base # image with basic ros melodic installed -# export WORKSPACE_BASE_IMAGE=developmentimage/ros_noetic_20.04:base # image with basic ros noetic installed -# export WORKSPACE_BASE_IMAGE=developmentimage/plain_20.04:base # plain image with build_essentials installed -export WORKSPACE_BASE_IMAGE=developmentimage/plain_18.04:base # plain image with build_essentials installed +# set desired processor architecture for image build +# available architectures on docker hub: https://github.com/docker-library/official-images#architectures-other-than-amd64 +# default: "" => x86_64 +export ARCH="arm64v8" +### The base image used when building a workspace image (one of the ones build in base_images) +# export WORKSPACE_BASE_IMAGE=developmentimage/${ARCH:+$ARCH/}rock_master_18.04:base # image with rock core dependencies installed +# export WORKSPACE_BASE_IMAGE=developmentimage/${ARCH:+$ARCH/}ros_melodic_18.04:base # image with basic ros melodic installed +# export WORKSPACE_BASE_IMAGE=developmentimage/${ARCH:+$ARCH/}ros_noetic_20.04:base # image with basic ros noetic installed +# export WORKSPACE_BASE_IMAGE=developmentimage/${ARCH:+$ARCH/}plain_20.04:base # plain image with build_essentials installed +export WORKSPACE_BASE_IMAGE=developmentimage/${ARCH:+$ARCH/}plain_18.04:base # plain image with build_essentials installed # The Name of the Workspace image to use # you should add a workspace name folder and a image name # e.g MY_PROJECT/docker_image_development:devel # under normal circumstances you should not need to change these -export WORKSPACE_DEVEL_IMAGE=developmentimage/${PROJECT_NAME}:devel -export WORKSPACE_RELEASE_IMAGE=developmentimage/${PROJECT_NAME}:release +export WORKSPACE_DEVEL_IMAGE=developmentimage/${ARCH:+$ARCH/}${PROJECT_NAME}:devel +export WORKSPACE_RELEASE_IMAGE=developmentimage/${ARCH:+$ARCH/}${PROJECT_NAME}:release # In case your docker container needs special run paramaters # like open ports, additional mounts etc.