diff --git a/.github/workflows/_build-image.yaml b/.github/workflows/_build-image.yaml index 23832aa..7471c18 100644 --- a/.github/workflows/_build-image.yaml +++ b/.github/workflows/_build-image.yaml @@ -73,8 +73,9 @@ jobs: file: ./${{ inputs.dockerfile }} platforms: ${{ inputs.architectures }} push: true - cache-from: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ inputs.push_image }}:${{ inputs.ros_distro }} - cache-to: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ inputs.push_image }}:${{ inputs.ros_distro }},mode=max + no-cache: true + # cache-from: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ inputs.push_image }}:${{ inputs.ros_distro }} + # cache-to: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ inputs.push_image }}:${{ inputs.ros_distro }},mode=max tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index f2c6942..c8f090b 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -37,7 +37,7 @@ 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 diff --git a/base.dockerfile b/base.dockerfile index 9eda8c9..81dec92 100644 --- a/base.dockerfile +++ b/base.dockerfile @@ -10,17 +10,27 @@ 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 || true \ + && apt-get install -y --no-install-recommends gnupg ca-certificates \ + && apt-get update \ + && apt-get upgrade -y + +RUN apt-get install -y --no-install-recommends \ build-essential \ + ca-certificates \ cmake \ git \ curl \ wget \ unzip \ ros-${ROS_DISTRO}-ros-base \ - python3-colcon-common-extensions \ + ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \ + python3-colcon-common-extensions && \ + rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* +ENV LANG=en_US.UTF-8 + RUN . /opt/ros/${ROS_DISTRO}/setup.sh && rosdep update ARG USERNAME=ros @@ -29,20 +39,27 @@ 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/* + && 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/* + +# 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 && \ + echo "RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> /etc/bash.bashrc && \ + echo "CYCLONEDDS_URI=file:///etc/cyclonedds.xml" >> /etc/bash.bashrc +USER ${USERNAME} CMD ["bash", "-l"] diff --git a/cuda.dockerfile b/cuda.dockerfile index 3093ba2..487dade 100644 --- a/cuda.dockerfile +++ b/cuda.dockerfile @@ -11,26 +11,28 @@ 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 || true \ + && apt-get install -y --no-install-recommends gnupg ca-certificates \ + && apt-get update \ + && apt-get upgrade -y + +RUN 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 \ @@ -40,8 +42,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 @@ -65,10 +71,13 @@ 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 && \ 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 && \ + echo "RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> /etc/bash.bashrc && \ + echo "CYCLONEDDS_URI=file:///etc/cyclonedds.xml" >> /etc/bash.bashrc ENV TVNC_VGL=1 ENV VGL_ISACTIVE=1 @@ -80,5 +89,7 @@ ENV VGL_PROBEGLX=0 ENV LD_PRELOAD=/usr/lib/libdlfaker.so:/usr/lib/libvglfaker.so ENV SHELL=/bin/bash +USER ${USERNAME} + CMD ["bash", "-l"] diff --git a/docker/cyclonedds.xml b/docker/cyclonedds.xml new file mode 100644 index 0000000..82132ff --- /dev/null +++ b/docker/cyclonedds.xml @@ -0,0 +1,10 @@ + + + + true + + + auto + + + \ No newline at end of file