diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 6d65f36..38db06d 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -23,19 +23,28 @@ jobs: include: - base_image: westonrobot/ros:humble-ci push_tag: westonrobot + dockerfile: Dockerfile + + - base_image: lscr.io/linuxserver/webtop:ubuntu-xfce + 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 @@ -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 }} diff --git a/Dockerfile.selkies b/Dockerfile.selkies new file mode 100644 index 0000000..f72e8d9 --- /dev/null +++ b/Dockerfile.selkies @@ -0,0 +1,100 @@ +ARG BASE_IMAGE=lscr.io/linuxserver/webtop:ubuntu-xfce + +########################################### +FROM ${BASE_IMAGE} AS base + +ENV DEBIAN_FRONTEND=noninteractive +# 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/* + +# 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 + +########################################### +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.5.0 +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 image_customisation +#COPY /root / +#RUN apt-get update && apt-get install -y firefox && rm -rf /var/lib/apt/lists/* +#ENV CUSTOM_PORT=5801 +#ENV NO_FULL=1 +COPY lcas.png /lcas.png +#ENV WATERMARK_PNG=/lcas.png +#ENV WATERMARK_LOCATION=5 +ENV TITLE="L-CAS Desktop Container" + +########################################### +FROM image_customisation AS user + +COPY .git /tmp/gittemp/.git +RUN mkdir -p /opt/image +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 + diff --git a/compose-selkies.yaml b/compose-selkies.yaml new file mode 100644 index 0000000..702d04b --- /dev/null +++ b/compose-selkies.yaml @@ -0,0 +1,30 @@ +services: + lcas_desktop: + #image: lscr.io/linuxserver/webtop:ubuntu-xfce + build: + context: . + dockerfile: Dockerfile.selkies + args: + BASE_IMAGE: lscr.io/linuxserver/webtop:ubuntu-xfce + ROS_DISTRO: jazzy + ports: + - "3000:3000" + - "3001:3001" + volumes: + # persist user's home + - user_home:/config + - /var/run/docker.sock:/var/run/docker.sock + shm_size: "1gb" #optional + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [compute,video,graphics,utility] + security_opt: + - seccomp:unconfined #optional + +volumes: + user_home: + name: ${COMPOSE_PROJECT_NAME}_lcas_desktop_user_${USER}