Skip to content
Merged
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
48 changes: 39 additions & 9 deletions .docker/cuda-13.1.0-ubuntu-24.04.Dockerfile → .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
FROM ubuntu:24.04 AS builder
# Build arguments for version configuration
ARG UBUNTU_VERSION=24.04
ARG CUDA_VERSION=13.1.0
ARG ROS_DISTRO=jazzy

FROM ubuntu:${UBUNTU_VERSION} AS builder

# Re-declare ARG after FROM to make it available in this stage
ARG ROS_DISTRO
ARG UBUNTU_VERSION

# setup
ENV DEBIAN_FRONTEND=noninteractive
ENV ROS_DISTRO=jazzy
ENV ROS_DISTRO=${ROS_DISTRO}

# install build dependencies
RUN apt-get update \
# add ROS 2 Jazzy sources, see e.g. https://docs.ros.org/en/jazzy/Installation/Ubuntu-Install-Debians.html
# add ROS 2 sources, see e.g. https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
&& apt-get install -y \
software-properties-common \
&& add-apt-repository universe \
Expand All @@ -31,6 +40,13 @@ RUN apt-get update \
ros-${ROS_DISTRO}-ament-cmake-pytest \
&& rm -rf /var/lib/apt/lists/*

# create ubuntu user (only needed for Ubuntu 22.04 as it doesn't exist in base image)
# Note: Ubuntu 24.04 base images already include the ubuntu user with uid=1000, gid=1000
RUN if [ "$UBUNTU_VERSION" = "22.04" ]; then \
groupadd --gid 1000 ubuntu \
&& useradd --uid 1000 --gid 1000 -m ubuntu; \
fi

# non-root user installation stuff
USER ubuntu
WORKDIR /home/ubuntu
Expand Down Expand Up @@ -77,22 +93,32 @@ RUN cd roboreg-deployment \
/home/ubuntu/.cache \
/tmp/*

FROM nvidia/cuda:13.1.0-base-ubuntu24.04 AS runtime
FROM nvidia/cuda:${CUDA_VERSION}-base-ubuntu${UBUNTU_VERSION} AS runtime

# Re-declare ARGs after FROM to make them available in this stage
ARG CUDA_VERSION
ARG UBUNTU_VERSION
ARG ROS_DISTRO

# setup
ENV DEBIAN_FRONTEND=noninteractive
ENV ROS_DISTRO=jazzy

# add ubuntu to sudoers: https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user
RUN apt-get update \
ENV ROS_DISTRO=${ROS_DISTRO}
# create ubuntu user and add to sudoers (only needed for Ubuntu 22.04 as it doesn't exist in base image)
# Note: Ubuntu 24.04 CUDA base images already include the ubuntu user with uid=1000, gid=1000
RUN if [ "$UBUNTU_VERSION" = "22.04" ]; then \
groupadd --gid 1000 ubuntu \
&& useradd --uid 1000 --gid 1000 -m ubuntu; \
fi \
# add ubuntu to sudoers: https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user
&& apt-get update \
&& apt-get install -y sudo \
&& echo ubuntu ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/ubuntu \
&& chmod 0440 /etc/sudoers.d/ubuntu \
&& rm -rf /var/lib/apt/lists/*

# install runtime dependencies
RUN apt-get update \
# add ROS 2 Jazzy sources, see e.g. https://docs.ros.org/en/jazzy/Installation/Ubuntu-Install-Debians.html
# add ROS 2 sources, see e.g. https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
&& apt-get install -y \
software-properties-common \
&& add-apt-repository universe \
Expand All @@ -109,6 +135,10 @@ RUN apt-get update \
ros-${ROS_DISTRO}-xacro \
libgl1 \
libxrender1 \
# python3-setuptools only needed for Ubuntu 22.04
&& if [ "$UBUNTU_VERSION" = "22.04" ]; then \
apt-get install -y python3-setuptools; \
fi \
&& rm -rf /var/lib/apt/lists/*

# copy roboreg-deployment from builder stage
Expand Down
137 changes: 0 additions & 137 deletions .docker/cuda-12.4.1-ubuntu-22.04.Dockerfile

This file was deleted.

19 changes: 16 additions & 3 deletions .github/workflows/docker.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a matrix and test both scenarios for which we had dedicated dockerfiles before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added matrix strategy to test both Ubuntu 22.04 (CUDA 12.4.1, ROS humble) and Ubuntu 24.04 (CUDA 13.1.0, ROS jazzy) configurations in commit 7501f75.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, love :)

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- ubuntu_version: "22.04"
cuda_version: "12.4.1"
ros_distro: "humble"
- ubuntu_version: "24.04"
cuda_version: "13.1.0"
ros_distro: "jazzy"
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -27,8 +36,12 @@ jobs:
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
file: .docker/cuda-13.1.0-ubuntu-24.04.Dockerfile
file: .docker/Dockerfile
build-args: |
UBUNTU_VERSION=${{ matrix.ubuntu_version }}
CUDA_VERSION=${{ matrix.cuda_version }}
ROS_DISTRO=${{ matrix.ros_distro }}
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
roboreg:latest
ghcr.io/lbr-stack/roboreg:latest
roboreg:${{ matrix.ubuntu_version }}
ghcr.io/lbr-stack/roboreg:${{ matrix.ubuntu_version }}
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,22 @@ Next:
cd roboreg
docker build \
-t roboreg:latest \
-f .docker/cuda-13.1.0-ubuntu-24.04.Dockerfile \
-f .docker/Dockerfile \
--build-arg UBUNTU_VERSION=24.04 \
--build-arg CUDA_VERSION=13.1.0 \
--build-arg ROS_DISTRO=jazzy \
.
```

For Ubuntu 22.04 with ROS 2 Humble and CUDA 12.4.1, use:

```shell
docker build \
-t roboreg:latest \
-f .docker/Dockerfile \
--build-arg UBUNTU_VERSION=22.04 \
--build-arg CUDA_VERSION=12.4.1 \
--build-arg ROS_DISTRO=humble \
.
```

Expand Down
Loading