1- FROM nvcr.io/nvidia/isaac-sim:4.2.0
1+ FROM osrf/ros:humble-desktop-full AS cacher
2+
3+ WORKDIR /ws/src
4+
5+ COPY . ar4/
6+
7+ RUN mkdir -p /tmp/ws/src \
8+ && find ./ -name "package.xml" | xargs cp --parents -t /tmp/ws/src \
9+ && find ./ -name "COLCON_IGNORE" | xargs cp --parents -t /tmp/ws/src \
10+ || true
11+
12+ FROM nvcr.io/nvidia/isaac-sim:4.2.0
213
314ENV DEBIAN_FRONTEND=noninteractive
415
@@ -7,8 +18,8 @@ RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o
718 && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
819
920# Install base system dependencies and development dependencies
10- RUN apt-get update \
11- && apt-get install --no-install-recommends -y \
21+ RUN apt update \
22+ && apt install --no-install-recommends -y \
1223 apt-utils \
1324 bash-completion \
1425 build-essential \
@@ -32,8 +43,8 @@ RUN apt-get update \
3243 screen \
3344 software-properties-common \
3445 sudo \
35- tmux && \
36- rm -rf /var/lib/apt/lists/*
46+ tmux \
47+ && rm -rf /var/lib/apt/lists/*
3748
3849# Install python dependencies
3950RUN pip install --no-cache-dir --extra-index-url https://pypi.nvidia.com \
@@ -58,26 +69,58 @@ RUN pip install --no-cache-dir --extra-index-url https://pypi.nvidia.com \
5869 isaacsim-utils==4.2.0.2 \
5970 nest-asyncio
6071
61- # Ensure cache folder is created, and symlink it to an easier to mount folder for persistance
72+ # Ensure cache folder is created, and symlink it to an easier to mount folder for persistence
6273RUN mkdir -p /usr/local/lib/python3.10/dist-packages/omni/cache \
63- && ln -s /usr/local/lib/python3.10/dist-packages/omni/cache /root/.isaac-sim-cache
74+ && ln -s /usr/local/lib/python3.10/dist-packages/omni/cache /root/.isaac-sim-cache
75+
6476
6577# Install ROS 2
66- RUN apt-get update \
67- && apt-get install --no-install-recommends -y \
68- ros-humble-desktop \
69- && rm -rf /var/lib/apt/lists/*
70-
71- # Install ros dependencies, updating the apt cache is necessary.
72- RUN --mount=type=bind,source=.,target=/tmp/ws \
73- rosdep init \
74- && apt-get update \
75- && . /opt/ros/humble/setup.sh \
76- && rosdep update \
77- && rosdep install --from-paths /tmp/ws --ignore-src -r -y \
78- && rm -rf /var/lib/apt/lists/*
79-
80- WORKDIR /workspace
81-
82- ENTRYPOINT ["/bin/bash", "-c"]
78+ RUN apt update \
79+ && apt install --no-install-recommends -y \
80+ ros-humble-ros-base \
81+ && rm -rf /var/lib/apt/lists/*
82+
83+ ARG USER=developer
84+ ARG GROUP=developer
85+
86+ ARG USERID=1000
87+ ARG GROUPID=1000
88+
89+ ENV USER $USER
90+ ENV GROUP $GROUP
91+
92+ RUN userdel ubuntu
93+
94+ RUN addgroup --gid $GROUPID $GROUP \
95+ && adduser --uid $USERID --ingroup $GROUP --home /home/$USER --shell /bin/sh --disabled-password --gecos "" $USER \
96+ && adduser $USER sudo \
97+ && echo "$USER ALL=NOPASSWD: ALL" >> /etc/sudoers.d/$USER
98+
99+ RUN curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - \
100+ && chown root:root /usr/local/bin/fixuid \
101+ && chmod 4755 /usr/local/bin/fixuid \
102+ && mkdir -p /etc/fixuid \
103+ && printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml
104+
105+ USER $USER
106+
107+ ENV USER_WS /workspace
108+ RUN sudo mkdir -p $USER_WS/src && sudo chown -R $USER:$GROUP $USER_WS
109+
110+ WORKDIR $USER_WS
111+
112+ #
113+ # Install ROS project dependencies by copying the package.xml files (but not the source code,
114+ # to avoid rebuilding the workspace every time the source code changes) and running rosdep install
115+ COPY --from=cacher --chown=$USER:$GROUP /tmp/ws/ $USER_WS/
116+ RUN sudo apt update \
117+ && . /opt/ros/humble/setup.sh \
118+ && sudo rosdep init \
119+ && rosdep update \
120+ && rosdep install -i -y -r --from-path src \
121+ && sudo rm -rf /var/lib/apt/lists/*
122+
123+ ENV WITHIN_DEV 1
124+
83125CMD ["/bin/bash"]
126+ ENTRYPOINT ["fixuid", "-q"]
0 commit comments