Files
agv_pro_ros2/.devcontainer/jazzy/Dockerfile.jazzy
T
2026-07-31 14:54:04 +00:00

79 lines
2.6 KiB
Docker

# syntax=docker/dockerfile:1.7-labs
FROM osrf/ros:jazzy-desktop-full
ARG USERNAME=USERNAME
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG TARGETARCH
# Delete user if it exists in container (e.g Ubuntu Noble: ubuntu)
RUN if id -u $USER_UID ; then userdel `id -un $USER_UID` ; fi
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& 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/*
# Make sure the base image is completely up to date
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
apt-get update \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
# C++ development tools
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
gdb \
clang \
clang-format \
clang-tidy \
libboost-all-dev \
&& rm -rf /var/lib/apt/lists/*
# Python development tools
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
apt-get update \
&& apt-get install -y --no-install-recommends \
python3-pip \
python3-dev \
python3-argcomplete \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool \
&& rm -rf /var/lib/apt/lists/*
# Copy boilerplate project config into workspace so it can be parsed by rosdep.
# This will be obscured by the volume mount or the workspace in the devcontainer
# Don't include all sources, because the rosdep will re-process on any file change
COPY --parents src/**/package.xml src/**/COLCON_IGNORE src/
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
apt-get update \
&& rosdep update --rosdistro $ROS_DISTRO \
&& rosdep install --from-paths src --ignore-src -y \
&& rm -rf /var/lib/apt/lists/*
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
apt-get update \
&& apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
&& rm -rf /var/lib/apt/lists/*
ENV SHELL=/bin/bash
# [Optional] Set the default user. Omit if you want to keep the default as root.
USER $USERNAME
CMD ["/bin/bash"]