Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,28 @@ jobs:
include:
- base_image: westonrobot/ros:humble-ci
push_tag: westonrobot
dockerfile: Dockerfile

- base_image: ghcr.io/selkies-project/nvidia-egl-desktop:24.04
push_tag: selkies-nvidia-24.04
dockerfile: Dockerfile.selkies

- base_image: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
push_tag: jammy-cuda11.8
dockerfile: Dockerfile

- base_image: nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
push_tag: jammy-cuda12.1
dockerfile: Dockerfile

- base_image: nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04
push_tag: jammy-cuda12.2
dockerfile: Dockerfile

- base_image: nvidia/cuda:12.6.3-cudnn-devel-ubuntu24.04
push_tag: noble-cuda12.6

dockerfile: Dockerfile

steps:
- name: Node Js
uses: actions/setup-node@v4
Expand Down Expand Up @@ -86,7 +95,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
file: ./${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ steps.docker_image_name.outputs.docker_image }}:${{ matrix.push_tag }}
Expand Down
166 changes: 166 additions & 0 deletions Dockerfile.selkies
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
ARG BASE_IMAGE=ghcr.io/selkies-project/nvidia-egl-desktop:24.04

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

ENV DEBIAN_FRONTEND=noninteractive

# Install language
RUN apt-get update ; \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
locales \
&& 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

# Install timezone
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update ; \
apt-get install -y --no-install-recommends tzdata \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update; apt-get -y upgrade \
&& rm -rf /var/lib/apt/lists/*

# Install common programs
RUN apt-get update; apt-get install -y --no-install-recommends \
curl \
gnupg2 \
lsb-release \
git \
nano \
sudo \
python3-setuptools \
software-properties-common \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

# Prepare ROS2
RUN add-apt-repository universe \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null

################
# 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 \
&& rm -rf /var/lib/apt/lists/*

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES=all
# enable all capabilities for the container
# Explained here: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/1.10.0/user-guide.html#driver-capabilities
ENV NVIDIA_DRIVER_CAPABILITIES=all
ENV QT_X11_NO_MITSHM=1


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

# Create a 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/*


###########################################
FROM base AS lcas

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y lsb-release curl software-properties-common unzip apt-transport-https && \
rm -rf /var/lib/apt/lists/*

RUN sh -c 'echo "deb https://lcas.lincoln.ac.uk/apt/lcas $(lsb_release -sc) lcas" > /etc/apt/sources.list.d/lcas-latest.list' && \
curl -s https://lcas.lincoln.ac.uk/apt/repo_signing.gpg > /etc/apt/trusted.gpg.d/lcas-latest.gpg

RUN mkdir -p /etc/ros/rosdep/sources.list.d/ && \
curl -o /etc/ros/rosdep/sources.list.d/20-default.list https://raw.githubusercontent.com/LCAS/rosdistro/master/rosdep/sources.list.d/20-default.list && \
curl -o /etc/ros/rosdep/sources.list.d/50-lcas.list https://raw.githubusercontent.com/LCAS/rosdistro/master/rosdep/sources.list.d/50-lcas.list

ENV ROSDISTRO_INDEX_URL=https://raw.github.com/LCAS/rosdistro/master/index-v4.yaml

ENV ZENOH_BRIDGE_VERSION=1.3.2
RUN cd /tmp; \
if [ "$(dpkg --print-architecture)" = "arm64" ]; then \
curl -L -O https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds/releases/download/${ZENOH_BRIDGE_VERSION}/zenoh-plugin-ros2dds-${ZENOH_BRIDGE_VERSION}-aarch64-unknown-linux-gnu-standalone.zip; \
else \
curl -L -O https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds/releases/download/${ZENOH_BRIDGE_VERSION}/zenoh-plugin-ros2dds-${ZENOH_BRIDGE_VERSION}-x86_64-unknown-linux-gnu-standalone.zip; \
fi; \
unzip zenoh-plugin-ros2dds-*.zip && \
mv zenoh-bridge-ros2dds /usr/local/bin/ && \
chmod +x /usr/local/bin/zenoh-bridge-ros2dds && \
ldconfig && \
rm -rf zenoh-*

# install nodejs
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
RUN apt-get update && apt-get install -y nodejs sudo && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*


###########################################
FROM lcas AS user
USER ros
ENV HOME=/home/ros
WORKDIR ${HOME}
RUN mkdir -p ${HOME}/.local/bin

USER root
COPY .gi? /tmp/gittemp/.git
RUN git -C /tmp/gittemp log -n 1 --pretty=format:"%H" > /opt/image/version

RUN echo "# Welcome to the L-CAS Desktop Container.\n" > /opt/image/info.md; \
echo "This is a Virtual Desktop provided by [L-CAS](https://lcas.lincoln.ac.uk/)." >> /opt/image/info.md; \
echo "\n" >> /opt/image/info.md; \
echo "*built from https://github.com/LCAS/ros-docker-images\n(commit: [\`$(cat /opt/image/version)\`](https://github.com/LCAS/ros-docker-images/tree/$(cat /opt/image/version)/)),\nprovided to you by [L-CAS](https://lcas.lincoln.ac.uk/).*" >> /opt/image/info.md; \
echo "\n" >> /opt/image/info.md; \
echo "## Installed Software\n" >> /opt/image/info.md; \
echo "The following software is installed:" >> /opt/image/info.md; \
echo "* The L-CAS ROS2 [apt repositories](https://lcas.lincoln.ac.uk/apt/lcas) are enabled." >> /opt/image/info.md; \
echo "* The L-CAS [rosdistro](https://github.com/LCAS/rosdistro) is enabled." >> /opt/image/info.md; \
echo "* The Zenoh ROS2 bridge \`zenoh-bridge-ros2dds\` (version: ${ZENOH_BRIDGE_VERSION})." >> /opt/image/info.md; \
echo "* Node.js (with npm) in version $(node --version)." >> /opt/image/info.md; \
echo "* password-less \`sudo\` to install more packages." >> /opt/image/info.md; \
echo "\n" >> /opt/image/info.md; \
echo "## Default Environment\n" >> /opt/image/info.md; \
echo "The following environment variables are set by default:" >> /opt/image/info.md; \
echo '```' >> /opt/image/info.md; \
env >> /opt/image/info.md; \
echo '```' >> /opt/image/info.md; \
chmod -w /opt/image/info.md
COPY README.md /opt/image/README.md

USER ros

RUN mkdir -p ${HOME}/Desktop/ && \
ln -s /opt/image/info.md ${HOME}/Desktop/info.md && \
ln -s /opt/image/README.md ${HOME}/Desktop/README.md

RUN mkdir -p ~/.config/rosdistro && echo "index_url: https://raw.github.com/LCAS/rosdistro/master/index-v4.yaml" > ~/.config/rosdistro/config.yaml

ENV SHELL=/bin/bash


Loading