Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
427 changes: 234 additions & 193 deletions scripts/Dockerfile.dependencies_humble

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions scripts/Dockerfile.humble
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,45 @@ WORKDIR /

# RoboticsInfrasctructure Repository
ARG ROBOTICS_INFRASTRUCTURE=$ROBOTICS_INFRASTRUCTURE
RUN mkdir -p /opt/jderobot && \
git clone --depth 1 https://github.com/JdeRobot/RoboticsInfrastructure.git -b $ROBOTICS_INFRASTRUCTURE /opt/jderobot

# create workspace and add Robot packages
RUN mkdir -p /home/ws/src
RUN mv /opt/jderobot/CustomRobots /opt/jderobot/jderobot_drones /home/ws/src/
RUN mv /opt/jderobot/resources /resources
# Launchers/, Worlds/, Universes/ are intentionally retained in /opt/jderobot (hardcoded in all launch files).
# Only .git history is stripped to recover extra space.
RUN mkdir -p /opt/jderobot /home/ws/src && \
git clone --depth 1 https://github.com/JdeRobot/RoboticsInfrastructure.git -b $ROBOTICS_INFRASTRUCTURE /opt/jderobot && \
mv /opt/jderobot/CustomRobots /opt/jderobot/jderobot_drones /opt/jderobot/jderobot_drones_cpp /opt/jderobot/Industrial /opt/jderobot/common_interfaces_cpp /home/ws/src/ && \
mv /opt/jderobot/resources /resources && \
mv -t / /opt/jderobot/scripts/.env /opt/jderobot/scripts/entrypoint.sh /opt/jderobot/scripts/ram_entrypoint.py /opt/jderobot/scripts/test/check_device.py /opt/jderobot/scripts/set_dri_name.sh /opt/jderobot/scripts/check_ram_version.sh && \
mv -f /opt/jderobot/scripts/rc.xml /etc/xdg/openbox/LXDE/rc.xml && \
chmod +x /entrypoint.sh /set_dri_name.sh && \
rm -rf /opt/jderobot/.git \
/opt/jderobot/.github \
/opt/jderobot/database \
/opt/jderobot/deprecated_assets \
/opt/jderobot/Docs \
/opt/jderobot/scripts \
/opt/jderobot/test \
/opt/jderobot/Universes \
/opt/jderobot/utils \
&& rm -f /opt/jderobot/Scenes/*.glb

ARG IMAGE_TAG
ENV IMAGE_TAG=${IMAGE_TAG}

# Clone the RoboticsApplicationManager repository into the src folder inside RoboticsAcademy
ARG RAM=$RAM
RUN git clone https://github.com/JdeRobot/RoboticsApplicationManager.git -b $RAM /RoboticsApplicationManager

# copy scripts
RUN mv -t / /opt/jderobot/scripts/.env /opt/jderobot/scripts/entrypoint.sh /opt/jderobot/scripts/start_vnc.sh /opt/jderobot/scripts/start_vnc_gpu.sh /opt/jderobot/scripts/kill_all.sh /opt/jderobot/scripts/test/check_device.py /opt/jderobot/scripts/set_dri_name.sh

# give execution permissions
WORKDIR /
RUN chmod +x /start_vnc.sh /kill_all.sh /entrypoint.sh /start_vnc_gpu.sh /set_dri_name.sh
RUN python3 -m pip install --no-cache-dir robotics_application_manager

# Compiling and sourcing the workspace
WORKDIR /home/ws
RUN /bin/bash -c "source /home/drones_ws/install/setup.bash"
RUN /bin/bash -c "source /home/industrial_ws/install/setup.bash"
RUN /bin/bash -c "source /opt/ros/humble/setup.bash; colcon build --symlink-install"
RUN /bin/bash -c "source /opt/ros/humble/setup.bash; colcon build --symlink-install --packages-ignore gz_ros2_control gz_ros2_control_demos"

# Manager websocket
EXPOSE 7163

# noVNC Console
EXPOSE 1108

# noVNC Gazebo
EXPOSE 6080
# Tools ports
EXPOSE 6080-6090

WORKDIR /

# Setting environment in both interactive or non-interactive shells
ENV BASH_ENV /.env
ENV BASH_ENV=/.env
ENTRYPOINT ["./entrypoint.sh", "-ns"]
74 changes: 43 additions & 31 deletions scripts/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
#!/bin/bash

# Default branch if not specified
ROBOTICS_ACADEMY="master"
ROBOTICS_INFRASTRUCTURE="noetic-devel"
RAM="main"
ROS_DISTRO="noetic"
ROBOTICS_ACADEMY="humble-devel"
ROBOTICS_INFRASTRUCTURE="humble-devel"
RAM="humble-devel"
ROS_DISTRO="humble"
IMAGE_TAG="test"
FORCE_BUILD=false
FORCE_BUILD_NO_CACHE=false

Help()
{
# Display Help
echo "Syntax: build.sh [options]"
echo "Options:"
echo " -h Print this Help."
echo " -f Force creation of the base image. If omitted, the base image is created only if "
echo " it doesn't exist."
echo " -a, --academy <value> Branch of RoboticsAcademy. Default: master"
echo " -i, --infra <value> Branch of RoboticsInfrastructure. Default: noetic-devel"
echo " -m, --ram <value> Branch of RoboticsApplicationManager. Default: main"
echo " -r, --ros <value> ROS Distro (humble or noetic). Default: noetic"
echo " -t, --tag <value> Tag name of the image. Default: test"
echo " -h Print this Help."
echo " -f Force creation of the base image. If omitted, the base image is created only if it doesn't exist."
echo " -F Force creation of the base image without using docker cache."
echo " -a, --academy <value> Branch of RoboticsAcademy. Default: humble-devel"
echo " -i, --infra <value> Branch of RoboticsInfrastructure. Default: humble-devel"
echo " -m, --ram <value> Branch of RoboticsApplicationManager. Default: humble-devel"
echo " -r, --ros <value> ROS Distro (humble). Default: humble"
echo " -t, --tag <value> Tag name of the image. Default: test"
echo
echo "Example:"
echo " ./build.sh -t my_image"
echo " ./build.sh -f -a master -i noetic-devel -m main -r noetic -t my_image"
echo " ./build.sh -f --academy master --infra noetic-devel --ram main --ros noetic --tag my_image"
echo
}

while [[ $# -gt 0 ]]; do
case "$1" in
-a | --academy)
-a | --academy)
ROBOTICS_ACADEMY="$2"
shift 2
;;
Expand All @@ -55,8 +53,12 @@ while [[ $# -gt 0 ]]; do
FORCE_BUILD=true
shift
;;
-h | --help) # display Help
echo "Generates RoboticsAcademy RADI image"
-F | --force-no-cache)
FORCE_BUILD_NO_CACHE=true
shift
;;
-h | --help)
echo "Generates Robotics Backend image"
echo
Help
exit 0
Expand All @@ -76,33 +78,43 @@ echo "ROS_DISTRO:-------------------:$ROS_DISTRO"
echo "IMAGE_TAG:--------------------:$IMAGE_TAG"
echo

# Determine Dockerfile based on ROS_DISTRO
if [[ $ROS_DISTRO == "noetic" ]]; then
DOCKERFILE_BASE="Dockerfile.dependencies_noetic"
DOCKERFILE="Dockerfile.noetic"
elif [[ $ROS_DISTRO == "humble" ]]; then
if [[ $ROS_DISTRO == "humble" ]]; then
DOCKERFILE_BASE="Dockerfile.dependencies_humble"
DOCKERFILE="Dockerfile.humble"
else
echo "Error: Unknown ROS_DISTRO ($ROS_DISTRO). Please set it to 'noetic' or 'humble'."
echo "Error: Unknown ROS_DISTRO ($ROS_DISTRO). Please set it to 'humble'."
exit 1
fi

# Build the Docker Base image
if $FORCE_BUILD || [[ "$(docker images -q jderobot/robotics-applications:dependencies-$ROS_DISTRO 2> /dev/null)" == "" ]]; then
if $FORCE_BUILD_NO_CACHE; then
NO_CACHE="--no-cache"
else
NO_CACHE=""
fi

if $FORCE_BUILD_NO_CACHE || $FORCE_BUILD || [[ "$(docker images -q jderobot/robotics-applications:dependencies-$ROS_DISTRO 2> /dev/null)" == "" ]]; then
echo "===================== BUILDING $ROS_DISTRO BASE IMAGE ====================="
echo "Building base using $DOCKERFILE_BASE for ROS $ROS_DISTRO"
docker build -f $DOCKERFILE_BASE -t jderobot/robotics-applications:dependencies-$ROS_DISTRO .
docker build $NO_CACHE -f $DOCKERFILE_BASE \
--build-arg TARGETARCH=$(uname -m | sed 's/x86_64/amd64/;s/arm64/arm64/') \
-t jderobot/robotics-applications:dependencies-$ROS_DISTRO .
fi

if [ $? -eq 0 ]; then
echo "Docker Base Image Build Successful"
else
echo "Docker Base Image Build FAILED...exiting"
exit
fi

# Build the Docker image
echo "===================== BUILDING $ROS_DISTRO RADI ====================="
echo "Building RADI using $DOCKERFILE for ROS $ROS_DISTRO"
echo "===================== BUILDING $ROS_DISTRO Robotics Backend ====================="
echo "Building Robotics Backend using $DOCKERFILE for ROS $ROS_DISTRO"

docker build --no-cache -f $DOCKERFILE \
--build-arg ROBOTICS_ACADEMY=$ROBOTICS_ACADEMY \
--build-arg ROBOTICS_INFRASTRUCTURE=$ROBOTICS_INFRASTRUCTURE \
--build-arg RAM=$RAM \
--build-arg ROS_DISTRO=$ROS_DISTRO \
--build-arg IMAGE_TAG=$IMAGE_TAG \
-t jderobot/robotics-academy:$IMAGE_TAG .
-t jderobot/robotics-backend:$IMAGE_TAG .

12 changes: 12 additions & 0 deletions scripts/config-nvidia-libs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
Auxiliary script for setting the Nvidia libraries in the RADI

Register all pip-installed nvidia .so files with ldconfig so onnxruntime-gpu
finds them regardless of whether pip used site-packages or dist-packages
"""

import sysconfig, pathlib

site = pathlib.Path(sysconfig.get_path("purelib"))
conf = "\n".join(str(d) for d in site.glob("nvidia/*/lib") if d.is_dir())
pathlib.Path("/etc/ld.so.conf.d/nvidia-pip.conf").write_text(conf + "\n")
Binary file removed scripts/gpu/virtualgl32_3.0.2_amd64.deb
Binary file not shown.
Binary file added scripts/gpu/virtualgl32_3.1.4_amd64.deb
Binary file not shown.
Binary file removed scripts/gpu/virtualgl_3.0.2_amd64.deb
Binary file not shown.
Binary file added scripts/gpu/virtualgl_3.1.4_amd64.deb
Binary file not shown.