From bf8129d73ea1d7e437a25d4c670597f5676b418f Mon Sep 17 00:00:00 2001 From: Yey007 <55263178+Yey007@users.noreply.github.com> Date: Sat, 24 Jan 2026 20:46:30 +0000 Subject: [PATCH 1/9] Fix dev container build --- .devcontainer.json | 7 ++- Dockerfile.dev | 50 +++++++++---------- install.sh | 11 ---- .../deployed_entrypoint.sh | 0 scripts/install_extra.sh | 11 ++++ 5 files changed, 38 insertions(+), 41 deletions(-) delete mode 100755 install.sh rename entrypoint.sh => scripts/deployed_entrypoint.sh (100%) create mode 100755 scripts/install_extra.sh diff --git a/.devcontainer.json b/.devcontainer.json index 994e6cf..c3a5a4c 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -11,6 +11,7 @@ "--ipc=host", "--privileged" ], + "containerUser": "cev", "containerEnv": { "DISPLAY": "${localEnv:DISPLAY}" }, @@ -20,10 +21,8 @@ "customizations": { "vscode": { "extensions": [ - "ms-iot.vscode-ros", - "ms-vscode.cpptools-extension-pack", "ms-python.black-formatter", - "xaver.clang-format" + "llvm-vs-code-extensions.vscode-clangd" ], "settings": { "terminal.integrated.defaultProfile.linux": "bash", @@ -33,7 +32,7 @@ } }, "[cpp]": { - "editor.defaultFormatter": "xaver.clang-format" + "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd" }, "[python]": { "diffEditor.ignoreTrimWhitespace": false, diff --git a/Dockerfile.dev b/Dockerfile.dev index 795e722..79db870 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -3,6 +3,13 @@ FROM ros:humble SHELL ["/bin/bash", "-c"] +# Set up CEV user +RUN useradd -m -s /bin/bash cev +RUN usermod -aG sudo cev +# Grant passwordless sudo access to the 'sudo' group +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +USER cev + ARG FOLDER_NAME=rc-brain ARG WORKSPACE_DIR=/home/cev WORKDIR $WORKSPACE_DIR @@ -12,35 +19,26 @@ RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc RUN echo "source $WORKSPACE_DIR/install/setup.bash" >> ~/.bashrc # Install dev tools -RUN apt-get update -RUN apt-get install -y curl -RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc -RUN cat /etc/apt/trusted.gpg.d/apt.llvm.org.asc -RUN echo $'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main\n' \ - $'deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy main\n' \ - $'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main\n' \ - $'deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main\n' \ - $'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main\n' \ - $'deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main\n' \ - | tee -a /etc/apt/sources.list -RUN apt-get update -RUN apt-get install -y clang-format clang-format-19 +RUN sudo apt-get update +# Tools required to run clang install +RUN sudo apt-get install -y \ + curl \ + lsb-release \ + software-properties-common \ + gnupg +RUN curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- 19 +RUN sudo apt-get install -y clangd-19 +RUN sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-19 100 # Init rosdep and update package index -# for some reason we need to do this -RUN rm /var/lib/dpkg/info/libc-bin.* -RUN apt-get clean -RUN apt-get update -RUN apt-get install -y libc-bin RUN rosdep update --rosdistro $ROS_DISTRO -RUN mkdir -p src/$FOLDER_NAME - -# Copy install.sh -COPY --parents ./install.sh src/$FOLDER_NAME +# Run install.sh, which installs additional dependencies +COPY scripts/install_extra.sh src/$FOLDER_NAME/scripts/ +RUN sudo src/$FOLDER_NAME/scripts/install_extra.sh -# Run install.sh -RUN src/$FOLDER_NAME/install.sh - -COPY --parents ./*/package.xml src/$FOLDER_NAME +RUN mkdir -p src/$FOLDER_NAME +COPY --parents **/package.xml src/$FOLDER_NAME/ RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y + +RUN sudo chown -R cev /home/cev diff --git a/install.sh b/install.sh deleted file mode 100755 index 757e3eb..0000000 --- a/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -apt install -y \ - libeigen3-dev \ - libnlopt-dev \ - libnlopt-cxx-dev \ - libopencv-dev \ - libyaml-cpp-dev \ - libqt5serialport5-dev \ - libsuitesparse-dev \ - libceres-dev \ - ros-humble-slam-toolbox diff --git a/entrypoint.sh b/scripts/deployed_entrypoint.sh similarity index 100% rename from entrypoint.sh rename to scripts/deployed_entrypoint.sh diff --git a/scripts/install_extra.sh b/scripts/install_extra.sh new file mode 100755 index 0000000..6a58aec --- /dev/null +++ b/scripts/install_extra.sh @@ -0,0 +1,11 @@ +#!/bin/bash +apt-get install -y \ + libeigen3-dev \ + libnlopt-dev \ + libnlopt-cxx-dev \ + libopencv-dev \ + libyaml-cpp-dev \ + libqt5serialport5-dev \ + libsuitesparse-dev \ + libceres-dev \ + ros-humble-slam-toolbox From 4d7a818ecc5fc9d06d8d542eb2dcf2a49c6e7f19 Mon Sep 17 00:00:00 2001 From: Yey007 <55263178+Yey007@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:31:22 +0000 Subject: [PATCH 2/9] Fix containers fr --- .github/workflows/docker-image.yml | 21 ++++++++--- Dockerfile | 56 ------------------------------ Dockerfile.deploy | 46 +++++++++++++----------- Dockerfile.dev | 6 ++-- README.md | 24 ++++++++----- 5 files changed, 60 insertions(+), 93 deletions(-) delete mode 100644 Dockerfile diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c3ffaa4..54f261a 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -7,17 +7,28 @@ on: branches: [ "main" ] jobs: - - build: - + build-deploy: runs-on: ubuntu-22.04 - steps: - name: Fetch recursively uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 + - name: Install buildx component + run: sudo apt install docker-buildx-plugin + - name: Build the Docker image + run: docker build . --file Dockerfile.deploy --tag rc-brain-deploy:$(date +%s) + build-dev: + runs-on: ubuntu-22.04 + steps: + - name: Fetch recursively + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: Install buildx component + run: sudo apt install docker-buildx-plugin - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) + run: docker build . --file Dockerfile.dev --tag rc-brain-dev:$(date +%s) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 09c2826..0000000 --- a/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# syntax=docker/dockerfile:1.7-labs -FROM ros:humble - -SHELL ["/bin/bash", "-c"] - -# Arguments -ARG FOLDER_NAME=rc-brain -ARG WORKSPACE_DIR=/home/cev - -# Set working directory -WORKDIR $WORKSPACE_DIR - -# Source ROS2 environment automatically in every shell -RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc -RUN echo "source $WORKSPACE_DIR/install/setup.bash" >> ~/.bashrc - -# Install dependencies -RUN apt-get update && apt-get install -y \ - curl \ - python3-colcon-common-extensions \ - ros-$ROS_DISTRO-ros-base \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -# Install clang-format -RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc && \ - echo $'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main\n' \ - $'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main\n' \ - $'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main\n' \ - | tee -a /etc/apt/sources.list && \ - apt-get update && apt-get install -y clang-format clang-format-19 \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -# Fix libc-bin issue -RUN rm /var/lib/dpkg/info/libc-bin.* || true && apt-get update && apt-get install -y libc-bin - -# Initialize rosdep -RUN rosdep update --rosdistro $ROS_DISTRO - -# Create workspace directory -RUN mkdir -p src/$FOLDER_NAME - -# Copy the full package source code -COPY --parents ./* src/$FOLDER_NAME/ -RUN chmod +x src/$FOLDER_NAME/install.sh && src/$FOLDER_NAME/install.sh - -# Install package dependencies -RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y - -# Build the ROS2 workspace -RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build --symlink-install - -# Set up entrypoint -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/Dockerfile.deploy b/Dockerfile.deploy index 03d49f2..d207901 100644 --- a/Dockerfile.deploy +++ b/Dockerfile.deploy @@ -3,6 +3,13 @@ FROM ros:humble SHELL ["/bin/bash", "-c"] +# Set up CEV user +RUN useradd -m -s /bin/bash cev +RUN usermod -aG sudo cev +# Grant passwordless sudo access to the 'sudo' group +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +USER cev + ARG FOLDER_NAME=rc-brain ARG WORKSPACE_DIR=/home/cev WORKDIR $WORKSPACE_DIR @@ -12,36 +19,35 @@ RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc RUN echo "source $WORKSPACE_DIR/install/setup.bash" >> ~/.bashrc # Init rosdep and update package index -# for some reason we need to do this -RUN rm /var/lib/dpkg/info/libc-bin.* -RUN apt-get clean -RUN apt-get update -RUN apt-get install libc-bin +RUN sudo apt-get update RUN rosdep update --rosdistro $ROS_DISTRO -RUN mkdir -p src/$FOLDER_NAME - # Install and build build-from-source packages # We do this as a separate step from the stuff for our code, since that changes more frequently -RUN cd src && \ - git clone https://github.com/Slamtec/sllidar_ros2.git && \ - cd sllidar_ros2 && \ - git checkout 3430009 +COPY --parents external/**/package.xml src/$FOLDER_NAME/ +RUN sudo chown -R cev /home/cev RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y -RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build -# Install self dependencies with rosdep -COPY --parents ./*/package.xml src/$FOLDER_NAME +# Run install.sh, which installs additional dependencies +COPY scripts/install_extra.sh src/$FOLDER_NAME/scripts/ +RUN sudo src/$FOLDER_NAME/scripts/install_extra.sh + +# Finally build external packages +COPY external src/$FOLDER_NAME/external/ +RUN sudo chown -R cev /home/cev +RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build --symlink-install + +# Install all other dependencies +COPY --parents **/package.xml src/$FOLDER_NAME/ +RUN sudo chown -R cev /home/cev RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y # Clean up apt cache to make container smaller -RUN apt-get clean +RUN sudo apt-get clean # Build COPY . src/$FOLDER_NAME -RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build +RUN sudo chown -R cev /home/cev +RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build --symlink-install -# Copy entrypoint script -COPY entrypoint.sh entrypoint.sh -RUN chmod +x entrypoint.sh -ENTRYPOINT ["/bin/bash", "/home/cev/entrypoint.sh"] +ENTRYPOINT ["/bin/bash", "/home/cev/src/rc-brain/scripts/deployed_entrypoint.sh"] diff --git a/Dockerfile.dev b/Dockerfile.dev index 79db870..94f7aac 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,3 @@ -# syntax=docker/dockerfile:1.7-labs FROM ros:humble SHELL ["/bin/bash", "-c"] @@ -35,10 +34,11 @@ RUN rosdep update --rosdistro $ROS_DISTRO # Run install.sh, which installs additional dependencies COPY scripts/install_extra.sh src/$FOLDER_NAME/scripts/ +RUN sudo chown -R cev /home/cev RUN sudo src/$FOLDER_NAME/scripts/install_extra.sh +# Install own dependencies RUN mkdir -p src/$FOLDER_NAME COPY --parents **/package.xml src/$FOLDER_NAME/ -RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y - RUN sudo chown -R cev /home/cev +RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y diff --git a/README.md b/README.md index 4fc738c..740fe91 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,9 @@ # rc-brain One repo to rule them all -## Installation +## Installation (local) `git clone --recurse-submodules https://github.com/cornellev/rc-brain.git` -`cd rc-brain && sudo ./install.sh` - -## Docker -`docker build -t cev-rc-autonomy .` -Then run either -`docker run --rm ros2-autonomy launch` -or -`docker run --rm ros2-autonomy teleop` +`cd rc-brain && sudo ./scripts/install_extra.sh` ## Development @@ -21,12 +14,25 @@ Run `./scripts/deploy/arduino_deploy.sh` to compile and flash code to the arduin #### Formatting If you're not using the DevContainer, please make sure to install `clang-format`, ideally version 19! This will help keep the formatting of our C++ code formatted consistently. Python code is formatted by `black`. The DevContainer will install the `Black` extension for you, which ships with `black`, but otherwise you'll need to install it in VSCode or whatever other IDE you're using. +### Docker (DevContainer) +Everything should pretty much work out of the box, except... +> [!WARNING] +> You must have the Docker buildx plugin installed to build the image correctly. You may get very confusing failures! +> On Ubuntu, you can install the `docker-buildx-plugin` package. + ### Deployment #### Regular deployment If you're just developing, building Docker images will probably take too long. You can deploy normally just by running `scripts/deploy.sh`. It will drop you into an interactive session at the end so you can launch whatever you want to. #### Docker deployment +Use `docker build . --file Dockerfile.deploy -t rc-brain-deploy:latest` to build the deploy container. +Then run either `docker run --rm rc-brain-deploy launch` or `docker run --rm rc-brain-deploy teleop` to launch. + +> [!WARNING] +> You must have the Docker buildx plugin installed to build the image correctly. You may get very confusing failures! +> On Ubuntu, you can install the `docker-buildx-plugin` package. + Our Docker deployment pipeline works by pushing Docker images to a local registry and pulling them down on the mini cars. This avoids both long build times on the mini cars and the long time it takes to transfer whole images (as we can take advantage of Docker's cache). You'll have to do a bit of setup to get your computer to use the local registry. Note that you must be connected to `cev-router`. From a635d6cdee1915c0d4085ef7d1ecf0fe0b6f4bc3 Mon Sep 17 00:00:00 2001 From: Yey007 <55263178+Yey007@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:34:49 +0000 Subject: [PATCH 3/9] Fix CI --- .github/workflows/docker-image.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 54f261a..95bddc7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,8 +15,10 @@ jobs: with: submodules: recursive fetch-depth: 0 + - name: Update repositories + run: sudo apt-get update - name: Install buildx component - run: sudo apt install docker-buildx-plugin + run: sudo apt-get install docker-buildx-plugin - name: Build the Docker image run: docker build . --file Dockerfile.deploy --tag rc-brain-deploy:$(date +%s) @@ -28,6 +30,8 @@ jobs: with: submodules: recursive fetch-depth: 0 + - name: Update repositories + run: sudo apt-get update - name: Install buildx component run: sudo apt install docker-buildx-plugin - name: Build the Docker image From 1be96cab89e7f634acbf71f620a39644b995bf65 Mon Sep 17 00:00:00 2001 From: Yey007 <55263178+Yey007@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:36:49 +0000 Subject: [PATCH 4/9] Fix CI --- .github/workflows/docker-image.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 95bddc7..534edf9 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,10 +15,8 @@ jobs: with: submodules: recursive fetch-depth: 0 - - name: Update repositories - run: sudo apt-get update - - name: Install buildx component - run: sudo apt-get install docker-buildx-plugin + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build the Docker image run: docker build . --file Dockerfile.deploy --tag rc-brain-deploy:$(date +%s) @@ -30,9 +28,7 @@ jobs: with: submodules: recursive fetch-depth: 0 - - name: Update repositories - run: sudo apt-get update - - name: Install buildx component - run: sudo apt install docker-buildx-plugin + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build the Docker image run: docker build . --file Dockerfile.dev --tag rc-brain-dev:$(date +%s) From dc46a9f43b961bf447a4c48a7eabd2e9e96510c6 Mon Sep 17 00:00:00 2001 From: Yey007 <55263178+Yey007@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:38:08 +0000 Subject: [PATCH 5/9] Fix CI --- Dockerfile.dev | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.dev b/Dockerfile.dev index 94f7aac..2e93011 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1.7-labs FROM ros:humble SHELL ["/bin/bash", "-c"] From ba344f08133ed6772863d376f8d2482c7844ae79 Mon Sep 17 00:00:00 2001 From: Utku Melemetci <55263178+utkudotdev@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:00:48 -0500 Subject: [PATCH 6/9] Fix comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Dockerfile.deploy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.deploy b/Dockerfile.deploy index d207901..26a949f 100644 --- a/Dockerfile.deploy +++ b/Dockerfile.deploy @@ -28,7 +28,7 @@ COPY --parents external/**/package.xml src/$FOLDER_NAME/ RUN sudo chown -R cev /home/cev RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y -# Run install.sh, which installs additional dependencies +# Run install_extra.sh, which installs additional dependencies COPY scripts/install_extra.sh src/$FOLDER_NAME/scripts/ RUN sudo src/$FOLDER_NAME/scripts/install_extra.sh From bb62937177d8bd92beb63a88693c960e6097baba Mon Sep 17 00:00:00 2001 From: Utku Melemetci <55263178+utkudotdev@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:01:07 -0500 Subject: [PATCH 7/9] Fix comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Dockerfile.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 2e93011..cf32c9c 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -33,7 +33,7 @@ RUN sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-19 # Init rosdep and update package index RUN rosdep update --rosdistro $ROS_DISTRO -# Run install.sh, which installs additional dependencies +# Run install_extra.sh, which installs additional dependencies COPY scripts/install_extra.sh src/$FOLDER_NAME/scripts/ RUN sudo chown -R cev /home/cev RUN sudo src/$FOLDER_NAME/scripts/install_extra.sh From 7a1352d42d6457f6496e80e2fca2b4f1cbc997ea Mon Sep 17 00:00:00 2001 From: Yey007 <55263178+Yey007@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:37:59 -0500 Subject: [PATCH 8/9] Update cev_planner submodule --- cev/cev_planner_ros2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cev/cev_planner_ros2 b/cev/cev_planner_ros2 index 098009a..090d71d 160000 --- a/cev/cev_planner_ros2 +++ b/cev/cev_planner_ros2 @@ -1 +1 @@ -Subproject commit 098009a81c3fcbf9815d64897482e08933ad1c34 +Subproject commit 090d71db71894ccb9ab6d4725facf5ac830880f1 From 7e755fdc737787a41a9944952b65349619445357 Mon Sep 17 00:00:00 2001 From: Utku Melemetci <55263178+utkudotdev@users.noreply.github.com> Date: Sun, 25 Jan 2026 03:51:09 +0000 Subject: [PATCH 9/9] Fix chown --- Dockerfile.deploy | 18 +++++++++--------- Dockerfile.dev | 9 +++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Dockerfile.deploy b/Dockerfile.deploy index 26a949f..0b8f613 100644 --- a/Dockerfile.deploy +++ b/Dockerfile.deploy @@ -10,6 +10,10 @@ RUN usermod -aG sudo cev RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers USER cev +# Docker doesn't do this by default +RUN sudo chown -R cev /home/cev + + ARG FOLDER_NAME=rc-brain ARG WORKSPACE_DIR=/home/cev WORKDIR $WORKSPACE_DIR @@ -24,30 +28,26 @@ RUN rosdep update --rosdistro $ROS_DISTRO # Install and build build-from-source packages # We do this as a separate step from the stuff for our code, since that changes more frequently -COPY --parents external/**/package.xml src/$FOLDER_NAME/ -RUN sudo chown -R cev /home/cev +COPY --chown=cev --parents external/**/package.xml src/$FOLDER_NAME/ RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y # Run install_extra.sh, which installs additional dependencies -COPY scripts/install_extra.sh src/$FOLDER_NAME/scripts/ +COPY --chown=cev scripts/install_extra.sh src/$FOLDER_NAME/scripts/ RUN sudo src/$FOLDER_NAME/scripts/install_extra.sh # Finally build external packages -COPY external src/$FOLDER_NAME/external/ -RUN sudo chown -R cev /home/cev +COPY --chown=cev external src/$FOLDER_NAME/external/ RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build --symlink-install # Install all other dependencies -COPY --parents **/package.xml src/$FOLDER_NAME/ -RUN sudo chown -R cev /home/cev +COPY --chown=cev --parents **/package.xml src/$FOLDER_NAME/ RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y # Clean up apt cache to make container smaller RUN sudo apt-get clean # Build -COPY . src/$FOLDER_NAME -RUN sudo chown -R cev /home/cev +COPY --chown=cev . src/$FOLDER_NAME RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build --symlink-install ENTRYPOINT ["/bin/bash", "/home/cev/src/rc-brain/scripts/deployed_entrypoint.sh"] diff --git a/Dockerfile.dev b/Dockerfile.dev index cf32c9c..833878c 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -14,6 +14,9 @@ ARG FOLDER_NAME=rc-brain ARG WORKSPACE_DIR=/home/cev WORKDIR $WORKSPACE_DIR +# Docker doesn't do this by default +RUN sudo chown -R cev /home/cev + # Source the ROS2 environment automatically when a new shell is created RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc RUN echo "source $WORKSPACE_DIR/install/setup.bash" >> ~/.bashrc @@ -34,12 +37,10 @@ RUN sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-19 RUN rosdep update --rosdistro $ROS_DISTRO # Run install_extra.sh, which installs additional dependencies -COPY scripts/install_extra.sh src/$FOLDER_NAME/scripts/ -RUN sudo chown -R cev /home/cev +COPY --chown=cev scripts/install_extra.sh src/$FOLDER_NAME/scripts/ RUN sudo src/$FOLDER_NAME/scripts/install_extra.sh # Install own dependencies RUN mkdir -p src/$FOLDER_NAME -COPY --parents **/package.xml src/$FOLDER_NAME/ -RUN sudo chown -R cev /home/cev +COPY --chown=cev --parents **/package.xml src/$FOLDER_NAME/ RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y