Skip to content

Commit

Permalink
feat: Add multi platform desktop docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
hmiranda-queiros committed Dec 9, 2023
1 parent 702c2a2 commit d0afded
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 103 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/docker_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,26 @@ jobs:
fail-fast: true
matrix:
include:
- dockerfile: ./docker_foxy_desktop/Dockerfile
context: ./docker_foxy_desktop
target: gazebo_nvidia
tag: foxy-desktop-nvidia
platform: linux/amd64
- dockerfile: ./docker_foxy_desktop/Dockerfile
context: ./docker_foxy_desktop
target: xplore_common
tag: foxy-desktop
platform: linux/amd64, linux/arm64
- dockerfile: ./docker_humble_desktop/Dockerfile
context: ./docker_humble_desktop
target: gazebo_nvidia
tag: humble-desktop-nvidia
platform: linux/amd64
- dockerfile: ./docker_humble_desktop/Dockerfile
context: ./docker_humble_desktop
target: xplore_common
tag: humble-desktop
platform: linux/amd64
platform: linux/amd64, linux/arm64
- dockerfile: ./docker_foxy_jetson/Dockerfile
context: ./docker_foxy_jetson
target: xplore_common
Expand Down
98 changes: 51 additions & 47 deletions docker_foxy_desktop/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,54 +90,10 @@ RUN rm -rf /var/lib/apt/lists/*

ENV AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1

###########################################
# Dev+Gazebo+Nvidia image
###########################################
FROM dev AS gazebo_nvidia

ARG DEBIAN_FRONTEND=noninteractive

# Install nvidia-driver version 470
RUN apt-get update && apt-get install -y nvidia-driver-470

# Install CUDA Toolkit 11.8
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb \
&& dpkg -i cuda-keyring_1.0-1_all.deb
RUN apt-get update && apt-get install -y --no-install-recommends cuda-toolkit-11-8

# Source CUDA
ENV CUDA_HOME=/usr/local/cuda-11.8
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
ENV PATH=${CUDA_HOME}/bin:$PATH

################
# Expose the nvidia driver to allow opengl
# Dependencies for glvnd and X11.
################
RUN apt-get update \
&& apt-get install -y -qq --no-install-recommends \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6

# Install Gazebo
RUN curl -sSL http://get.gazebosim.org | sh

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

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV QT_X11_NO_MITSHM 1

###########################################
# Xplore Common image
###########################################
FROM gazebo_nvidia AS xplore_common
FROM dev AS xplore_common

ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -166,7 +122,6 @@ RUN /etc/init.d/udev restart
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-behaviortree-cpp-v3 \
ros-${ROS_DISTRO}-gazebo-ros-pkgs \
ros-${ROS_DISTRO}-xacro

WORKDIR /home/$USERNAME
Expand All @@ -177,4 +132,53 @@ RUN usermod -aG dialout $USERNAME
RUN usermod -aG video $USERNAME

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

###########################################
# Dev+Gazebo+Nvidia image
###########################################
FROM xplore_common AS gazebo_nvidia

ARG DEBIAN_FRONTEND=noninteractive

# Install nvidia-driver version 470
RUN apt-get update && apt-get install -y nvidia-driver-470

# Install CUDA Toolkit 11.8
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb \
&& dpkg -i cuda-keyring_1.0-1_all.deb
RUN apt-get update && apt-get install -y --no-install-recommends cuda-toolkit-11-8

# Source CUDA
ENV CUDA_HOME=/usr/local/cuda-11.8
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
ENV PATH=${CUDA_HOME}/bin:$PATH

################
# Expose the nvidia driver to allow opengl
# Dependencies for glvnd and X11.
################
RUN apt-get update \
&& apt-get install -y -qq --no-install-recommends \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6

# Install Gazebo
RUN curl -sSL http://get.gazebosim.org | sh

# Install Gazebo ROS packages
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-gazebo-ros-pkgs

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

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV QT_X11_NO_MITSHM 1
2 changes: 1 addition & 1 deletion docker_foxy_desktop/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker build --progress=plain -t ghcr.io/epflxplore/docker_commons:foxy-desktop --target xplore_common .
docker build --progress=plain -t ghcr.io/epflxplore/docker_commons:foxy-desktop-nvidia --target gazebo_nvidia .
2 changes: 1 addition & 1 deletion docker_foxy_desktop/fresh_build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker build --pull --no-cache --progress=plain -t ghcr.io/epflxplore/docker_commons:foxy-desktop --target xplore_common .
docker build --pull --no-cache --progress=plain -t ghcr.io/epflxplore/docker_commons:foxy-desktop-nvidia --target gazebo_nvidia .
4 changes: 2 additions & 2 deletions docker_foxy_desktop/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ echo ""
echo "Running docker..."

docker run -it \
--name xplore_foxy_desktop \
--name xplore_foxy_desktop_nvidia \
--rm \
--runtime=nvidia \
--gpus all \
Expand All @@ -39,4 +39,4 @@ docker run -it \
-v $XAUTH:$XAUTH \
-v /run/user/1000/at-spi:/run/user/1000/at-spi \
-v /dev:/dev \
ghcr.io/epflxplore/docker_commons:foxy-desktop
ghcr.io/epflxplore/docker_commons:foxy-desktop-nvidia
98 changes: 51 additions & 47 deletions docker_humble_desktop/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,54 +90,10 @@ RUN rm -rf /var/lib/apt/lists/*

ENV AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1

###########################################
# Dev+Gazebo+Nvidia image
###########################################
FROM dev AS gazebo_nvidia

ARG DEBIAN_FRONTEND=noninteractive

# Install nvidia-driver version 470
RUN apt-get update && apt-get install -y nvidia-driver-470

# Install CUDA Toolkit 11.8
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& dpkg -i cuda-keyring_1.0-1_all.deb
RUN apt-get update && apt-get install -y --no-install-recommends cuda-toolkit-11-8

# Source CUDA
ENV CUDA_HOME=/usr/local/cuda-11.8
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
ENV PATH=${CUDA_HOME}/bin:$PATH

################
# Expose the nvidia driver to allow opengl
# Dependencies for glvnd and X11.
################
RUN apt-get update \
&& apt-get install -y -qq --no-install-recommends \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6

# Install Gazebo
RUN curl -sSL http://get.gazebosim.org | sh

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

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV QT_X11_NO_MITSHM 1

###########################################
# Xplore Common image
###########################################
FROM gazebo_nvidia AS xplore_common
FROM dev AS xplore_common

ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -166,7 +122,6 @@ RUN /etc/init.d/udev restart
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-behaviortree-cpp-v3 \
ros-${ROS_DISTRO}-gazebo-ros-pkgs \
ros-${ROS_DISTRO}-xacro

WORKDIR /home/$USERNAME
Expand All @@ -177,4 +132,53 @@ RUN usermod -aG dialout $USERNAME
RUN usermod -aG video $USERNAME

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

###########################################
# Dev+Gazebo+Nvidia image
###########################################
FROM xplore_common AS gazebo_nvidia

ARG DEBIAN_FRONTEND=noninteractive

# Install nvidia-driver version 470
RUN apt-get update && apt-get install -y nvidia-driver-470

# Install CUDA Toolkit 11.8
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& dpkg -i cuda-keyring_1.0-1_all.deb
RUN apt-get update && apt-get install -y --no-install-recommends cuda-toolkit-11-8

# Source CUDA
ENV CUDA_HOME=/usr/local/cuda-11.8
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
ENV PATH=${CUDA_HOME}/bin:$PATH

################
# Expose the nvidia driver to allow opengl
# Dependencies for glvnd and X11.
################
RUN apt-get update \
&& apt-get install -y -qq --no-install-recommends \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6

# Install Gazebo
RUN curl -sSL http://get.gazebosim.org | sh

# Install Gazebo ROS packages
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-gazebo-ros-pkgs

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

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV QT_X11_NO_MITSHM 1
2 changes: 1 addition & 1 deletion docker_humble_desktop/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker build --progress=plain -t ghcr.io/epflxplore/docker_commons:humble-desktop --target xplore_common .
docker build --progress=plain -t ghcr.io/epflxplore/docker_commons:humble-desktop-nvidia --target gazebo_nvidia .
2 changes: 1 addition & 1 deletion docker_humble_desktop/fresh_build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker build --pull --no-cache --progress=plain -t ghcr.io/epflxplore/docker_commons:humble-desktop --target xplore_common .
docker build --pull --no-cache --progress=plain -t ghcr.io/epflxplore/docker_commons:humble-desktop-nvidia --target gazebo_nvidia .
4 changes: 2 additions & 2 deletions docker_humble_desktop/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ echo ""
echo "Running docker..."

docker run -it \
--name xplore_humble_desktop \
--name xplore_humble_desktop_nvidia \
--rm \
--runtime=nvidia \
--gpus all \
Expand All @@ -39,4 +39,4 @@ docker run -it \
-v $XAUTH:$XAUTH \
-v /run/user/1000/at-spi:/run/user/1000/at-spi \
-v /dev:/dev \
ghcr.io/epflxplore/docker_commons:humble-desktop
ghcr.io/epflxplore/docker_commons:humble-desktop-nvidia

0 comments on commit d0afded

Please sign in to comment.