Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
5 changes: 4 additions & 1 deletion .github/workflows/_build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}

- name: Pull base image
run: docker pull ${{ inputs.base_image }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -79,4 +82,4 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_IMAGE=${{ inputs.base_image }}
ROS_DISTRO=${{ inputs.ros_distro }}
ROS_DISTRO=${{ inputs.ros_distro }}
4 changes: 2 additions & 2 deletions .github/workflows/docker-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
with:
base_image: nvidia/cuda:11.8.0-runtime-ubuntu22.04
push_image: ros_cuda
ros_distro: humble
ros_distro: humble
dockerfile: cuda.dockerfile
architectures: linux/amd64
secrets: inherit

ros-cuda-jazzy:
uses: ./.github/workflows/_build-image.yaml
with:
base_image: nvidia/cuda:12.6.3-cudnn-devel-ubuntu24.04
base_image: nvidia/cuda:12.9.1-runtime-ubuntu24.04
push_image: ros_cuda
ros_distro: jazzy
dockerfile: cuda.dockerfile
Expand Down
39 changes: 27 additions & 12 deletions base.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,54 @@ ENV ROS_DISTRO=${ROS_DISTRO}

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get upgrade -y && apt-get install -y \
RUN apt-get update \
&& apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
gnupg \
cmake \
git \
curl \
wget \
unzip \
ros-${ROS_DISTRO}-ros-base \
python3-colcon-common-extensions \
&& rm -rf /var/lib/apt/lists/*
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
python3-colcon-common-extensions && \
rm -rf /var/lib/apt/lists/*

ENV LANG=en_US.UTF-8

RUN . /opt/ros/${ROS_DISTRO}/setup.sh && rosdep update

ARG USERNAME=ros
ARG USER_UID=1001
ARG USER_GID=$USER_UID

# Create a non-root user
# Create a non-root user and add sudo support for the non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# Add sudo support for the non-root user
&& apt-get update \
&& apt-get install -y --no-install-recommends sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& rm -rf /var/lib/apt/lists/*
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y --no-install-recommends sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& rm -rf /var/lib/apt/lists/*

# Cyclone DDS Config
COPY cyclonedds.xml /etc/cyclonedds.xml

# Configure bash profile
RUN echo "if [ -f /etc/bash.bashrc ]; then source /etc/bash.bashrc; fi" >> /root/.bashrc && \
echo "if [ -f /etc/bash.bashrc ]; then source /etc/bash.bashrc; fi" >> /home/${USERNAME}/.bashrc && \
echo 'PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "' >> /etc/bash.bashrc && \
echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /etc/bash.bashrc && \
echo "alias t='tmux'" >> /etc/bash.bashrc && \
echo "alias cls='clear'" >> /etc/bash.bashrc
echo "alias cls='clear'" >> /etc/bash.bashrc && \
chown ${USERNAME}:${USER_GID} /home/${USERNAME}/.bashrc

ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ENV CYCLONEDDS_URI=file:///etc/cyclonedds.xml

USER ${USERNAME}
CMD ["bash", "-l"]

26 changes: 17 additions & 9 deletions cuda.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,25 @@ ENV ROS_DISTRO=${ROS_DISTRO}

ENV DEBIAN_FRONTEND=noninteractive

# Install language
RUN apt-get update ; \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
locales \
curl \
wget \
ca-certificates \
gnupg2 \
lsb-release \
git \
nano \
python3-setuptools \
software-properties-common \
wget \
tzdata \
&& locale-gen en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
ENV LANG=en_US.UTF-8

RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
ENV LANG=en_US.UTF-8

# Prepare ROS2
RUN add-apt-repository universe \
Expand All @@ -40,8 +39,12 @@ RUN add-apt-repository universe \
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-ros-base \
python3-rosdep \
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
&& rm -rf /var/lib/apt/lists/*

# Cyclone DDS Config
COPY cyclonedds.xml /etc/cyclonedds.xml

RUN . /opt/ros/${ROS_DISTRO}/setup.sh && rosdep init && rosdep update

# Setup VirtualGL
Expand All @@ -65,11 +68,15 @@ RUN groupadd --gid $USER_GID $USERNAME \

# Configure bash profile
RUN echo "if [ -f /etc/bash.bashrc ]; then source /etc/bash.bashrc; fi" >> /root/.bashrc && \
echo "if [ -f /etc/bash.bashrc ]; then source /etc/bash.bashrc; fi" >> /home/${USERNAME}/.bashrc && \
chown ${USERNAME}:${USERNAME} /home/${USERNAME}/.bashrc && \
echo 'PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "' >> /etc/bash.bashrc && \
echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /etc/bash.bashrc && \
echo "alias t='tmux'" >> /etc/bash.bashrc && \
echo "alias cls='clear'" >> /etc/bash.bashrc


ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ENV CYCLONEDDS_URI=file:///etc/cyclonedds.xml
ENV TVNC_VGL=1
ENV VGL_ISACTIVE=1
ENV VGL_FPS=25
Expand All @@ -80,5 +87,6 @@ ENV VGL_PROBEGLX=0
ENV LD_PRELOAD=/usr/lib/libdlfaker.so:/usr/lib/libvglfaker.so
ENV SHELL=/bin/bash

CMD ["bash", "-l"]
USER ${USERNAME}

CMD ["bash", "-l"]
6 changes: 3 additions & 3 deletions cuda_desktop.dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG BASE_IMAGE
ARG BASE_IMAGE=lcas.lincoln.ac.uk/ros_cuda:humble-main

###########################################
FROM ${BASE_IMAGE} AS base

RUN apt-get update && apt-get install -y --no-install-recommends \
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-desktop \
&& rm -rf /var/lib/apt/lists/*
&& sudo rm -rf /var/lib/apt/lists/*
10 changes: 10 additions & 0 deletions docker/cyclonedds.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<CycloneDDS>
<Domain>
<General>
<AllowMulticast>true</AllowMulticast>
</General>
<Discovery>
<ParticipantIndex>auto</ParticipantIndex>
</Discovery>
</Domain>
</CycloneDDS>