Skip to content

Commit ca87b9f

Browse files
authored
Refactor Devcontainer Dockerfile (Root User/Bind Mounts) and Restores GitHub Actions Workflows (#19)
* fix: update base image * fix: restore image tag, ensure root user for apt install Resolves #18 * fix: re-enable workflows and improve copy resolving #17 * fix: ensure workspace is set explicitly * fix: rm caching from devcontainer ci action * fix: move rosdep inside root session, remove desktop install * ci: force rebuild
1 parent 5aa0896 commit ca87b9f

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ ARG ROS_DISTRO=humble
33

44
FROM ${BASE_IMAGE} AS devcontainer
55

6+
ENV main_user=${USER:-root}
7+
8+
USER root
69
RUN rm -rf /var/lib/apt/lists/* \
710
&& apt-get update --fix-missing \
811
&& apt-get -y install --no-install-recommends --fix-missing \
9-
ros-${ROS_DISTRO}-desktop \
10-
bash-completion \
12+
bash-completion \
1113
&& rm -rf /var/lib/apt/lists/*
1214

13-
COPY ./ /workspace/
1415
WORKDIR /workspace
15-
1616
ENV ROS2_WS=/workspace
17-
RUN rosdep update --rosdistro ${ROS_DISTRO} &&\
18-
apt-get update && \
19-
rosdep install --from-paths ./src --ignore-src -r -y
17+
RUN --mount=type=bind,source=.,target=/workspace rosdep update --rosdistro ${ROS_DISTRO} \
18+
&& apt-get update \
19+
&& rosdep install --from-paths /workspace/src --ignore-src -r -y
20+
21+
USER ${main_user}
2022

2123
# Do an initial build to speed up development
2224
RUN /bin/bash -lc "source /opt/ros/${ROS_DISTRO}/setup.bash && colcon build --continue-on-error"
@@ -26,4 +28,4 @@ FROM devcontainer AS final
2628

2729
RUN /bin/bash -lc "source /opt/ros/${ROS_DISTRO}/setup.bash && colcon build"
2830

29-
CMD ["/bin/bash", "-lc", "source /workspace/install/setup.bash && exec ros2 launch example example.launch.py"]
31+
CMD ["/bin/bash", "-lc", "source /workspace/install/setup.bash && exec ros2 launch example example.launch.py"]
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,3 @@ jobs:
3434
imageName: devcontainer/${{ steps.docker_image_name.outputs.docker_image }}
3535
configFile: ./.devcontainer/devcontainer.json
3636
push: never
37-
cacheFrom: type=gha
38-
cacheTo: type=gha,mode=max

0 commit comments

Comments
 (0)