From 0b5e17e4fe34278c465d65f3e2ae53aa07aac450 Mon Sep 17 00:00:00 2001 From: SimonR99 Date: Sat, 6 Apr 2024 17:59:38 -0400 Subject: [PATCH 1/4] real fix, I hope --- .devcontainer/Dockerfile | 40 +++++++++++++++++++++++++++----- src/rove_description/package.xml | 1 - 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c473f89..498899a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/clubcapra/gazebo:harmonic +FROM ros:humble-ros-base # Add vscode user with same UID and GID as your host system # (copied from https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user) @@ -6,6 +6,10 @@ ARG USERNAME=rove ARG USER_UID=1000 ARG USER_GID=$USER_UID +# ENV variables +ENV ROS_DISTRO=humble +ENV GZ_VERSION=harmonic + WORKDIR /workspace/$USERNAME RUN groupadd --gid $USER_GID $USERNAME || true \ @@ -22,17 +26,41 @@ RUN apt update && apt upgrade -y # Install Git RUN apt install -y git +# Install necessary packages for Gazebo Garden and its dependencies +RUN apt-get update && apt-get install -y \ + software-properties-common \ + wget \ + lsb-release \ + gnupg \ + curl + +# Install Gazebo +RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg +RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null + +RUN apt update -y + +RUN apt install -y ros-humble-ros-gzharmonic + +# Adding an APT update and clean step +RUN apt-get update && \ + apt-get install -y --no-install-recommends apt-utils && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get clean && \ + apt-get update + # Change user +RUN chown $USERNAME:$USERNAME /workspace/$USERNAME + USER $USERNAME # Source the ROS setup file -RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc && \ - echo "source /gazebo/gazebo_ws/install/setup.bash" >> ~/.bashrc +RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc + +COPY --chown=rove ./ /workspace/$USERNAME # Install ROS dependencies RUN rosdep update # Copy to preload the ros packages -COPY ./ /workspace/$USERNAME/ - -RUN rosdep install --from-paths src --ignore-src --rosdistro humble -y +RUN rosdep install --from-paths src --ignore-src --rosdistro humble -y \ No newline at end of file diff --git a/src/rove_description/package.xml b/src/rove_description/package.xml index e7763d3..4257854 100644 --- a/src/rove_description/package.xml +++ b/src/rove_description/package.xml @@ -9,7 +9,6 @@ rviz2 xacro - ros_gz_bridge ament_cmake From 97fe4856aa3127463e9353aa13b7b5ff817af3d5 Mon Sep 17 00:00:00 2001 From: SimonR99 Date: Sat, 6 Apr 2024 18:06:36 -0400 Subject: [PATCH 2/4] switch username chown --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 498899a..2ef0a2d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -57,7 +57,7 @@ USER $USERNAME # Source the ROS setup file RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc -COPY --chown=rove ./ /workspace/$USERNAME +COPY --chown=$USERNAME ./ /workspace/$USERNAME # Install ROS dependencies RUN rosdep update From 70a31a20d36407da55dacc0b186365fb3b5bd537 Mon Sep 17 00:00:00 2001 From: Samuel Lachance Date: Sat, 6 Apr 2024 18:14:25 -0400 Subject: [PATCH 3/4] Use USER_UID instead of USERNAME --- .devcontainer/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2ef0a2d..745dadc 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -38,7 +38,7 @@ RUN apt-get update && apt-get install -y \ RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null -RUN apt update -y +RUN apt update -y RUN apt install -y ros-humble-ros-gzharmonic @@ -50,7 +50,7 @@ RUN apt-get update && \ apt-get update # Change user -RUN chown $USERNAME:$USERNAME /workspace/$USERNAME +RUN chown $USER_UID:$USER_GID /workspace/$USERNAME USER $USERNAME @@ -63,4 +63,4 @@ COPY --chown=$USERNAME ./ /workspace/$USERNAME RUN rosdep update # Copy to preload the ros packages -RUN rosdep install --from-paths src --ignore-src --rosdistro humble -y \ No newline at end of file +RUN rosdep install --from-paths src --ignore-src --rosdistro humble -y From 725599f0bb074eed1fa58b03c92f7b33a02acec6 Mon Sep 17 00:00:00 2001 From: SimonR99 Date: Sat, 6 Apr 2024 20:03:10 -0400 Subject: [PATCH 4/4] remove sudo --- .devcontainer/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 745dadc..e4f0c06 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -36,7 +36,7 @@ RUN apt-get update && apt-get install -y \ # Install Gazebo RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg -RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null +RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null RUN apt update -y @@ -61,6 +61,6 @@ COPY --chown=$USERNAME ./ /workspace/$USERNAME # Install ROS dependencies RUN rosdep update -# Copy to preload the ros packages + RUN rosdep install --from-paths src --ignore-src --rosdistro humble -y