@@ -5,30 +5,32 @@ FROM $BASE_IMAGE AS base
5
5
SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
6
6
ARG ROS_DISTRO
7
7
8
+ # Copy files
9
+ COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/
10
+ COPY ansible/ /autoware/ansible/
11
+ COPY docker/scripts/cleanup_apt.sh /autoware/cleanup_apt.sh
12
+ RUN chmod +x /autoware/cleanup_apt.sh
13
+ COPY docker/scripts/cleanup_system.sh /autoware/cleanup_system.sh
14
+ RUN chmod +x /autoware/cleanup_system.sh
15
+ WORKDIR /autoware
16
+
8
17
# Install apt packages and add GitHub to known hosts for private repositories
9
18
RUN rm -f /etc/apt/apt.conf.d/docker-clean \
10
19
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache
11
20
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
12
21
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
13
22
gosu \
14
23
ssh \
15
- && apt-get autoremove -y && rm -rf "$HOME" /.cache \
24
+ && /autoware/cleanup_apt.sh \
16
25
&& mkdir -p ~/.ssh \
17
26
&& ssh-keyscan github.com >> ~/.ssh/known_hosts
18
27
19
- # Copy files
20
- COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/
21
- COPY ansible/ /autoware/ansible/
22
- COPY docker/scripts/cleanup_system.sh /autoware/cleanup_system.sh
23
- RUN chmod +x /autoware/cleanup_system.sh
24
- WORKDIR /autoware
25
-
26
28
# Set up base environment
27
29
RUN --mount=type=ssh \
28
30
--mount=type=cache,target=/var/cache/apt,sharing=locked \
29
31
./setup-dev-env.sh -y --module base --no-nvidia --no-cuda-drivers --runtime openadkit \
30
32
&& pip uninstall -y ansible ansible-core \
31
- && apt-get autoremove -y && rm -rf "$HOME" /.cache \
33
+ && /autoware/cleanup_apt.sh \
32
34
&& echo "source /opt/ros/${ROS_DISTRO}/setup.bash" > /etc/bash.bashrc
33
35
34
36
# Create entrypoint
@@ -45,7 +47,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
45
47
RUN --mount=type=ssh \
46
48
./setup-dev-env.sh -y --module base --download-artifacts --no-cuda-drivers --runtime openadkit \
47
49
&& pip uninstall -y ansible ansible-core \
48
- && apt-get autoremove -y && rm -rf "$HOME" /.cache
50
+ && /autoware/cleanup_apt.sh true
49
51
50
52
# hadolint ignore=DL3006
51
53
FROM $BASE_IMAGE AS rosdep-depend
@@ -54,6 +56,8 @@ ARG ROS_DISTRO
54
56
55
57
COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/
56
58
COPY ansible/ /autoware/ansible/
59
+ COPY docker/scripts/cleanup_apt.sh /autoware/cleanup_apt.sh
60
+ RUN chmod +x /autoware/cleanup_apt.sh
57
61
COPY docker/scripts/resolve_rosdep_keys.sh /autoware/resolve_rosdep_keys.sh
58
62
RUN chmod +x /autoware/resolve_rosdep_keys.sh
59
63
WORKDIR /autoware
@@ -64,7 +68,7 @@ RUN --mount=type=ssh \
64
68
--mount=type=cache,target=/var/cache/apt,sharing=locked \
65
69
./setup-dev-env.sh -y rosdep \
66
70
&& pip uninstall -y ansible ansible-core \
67
- && apt-get autoremove -y && rm -rf "$HOME" /.cache
71
+ && /autoware/cleanup_apt.sh
68
72
69
73
# Generate install package lists
70
74
COPY src/core /autoware/src/core
@@ -169,15 +173,15 @@ RUN --mount=type=ssh \
169
173
./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers openadkit \
170
174
&& ./setup-dev-env.sh -y --module dev-tools openadkit \
171
175
&& pip uninstall -y ansible ansible-core \
172
- && apt-get autoremove -y && rm -rf "$HOME" /.cache
176
+ && /autoware/cleanup_apt.sh
173
177
174
178
# Install rosdep dependencies
175
179
COPY --from=rosdep-depend /rosdep-core-depend-packages.txt /tmp/rosdep-core-depend-packages.txt
176
180
# hadolint ignore=SC2002
177
181
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
178
182
apt-get update \
179
183
&& cat /tmp/rosdep-core-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
180
- && apt-get autoremove -y && rm -rf "$HOME" /.cache
184
+ && /autoware/cleanup_apt.sh
181
185
182
186
RUN --mount=type=cache,target=${CCACHE_DIR} \
183
187
--mount=type=bind,from=rosdep-depend,source=/autoware/src/core,target=/autoware/src/core \
@@ -196,9 +200,10 @@ ENV CCACHE_DIR="/root/.ccache"
196
200
COPY --from=rosdep-depend /rosdep-universe-common-depend-packages.txt /tmp/rosdep-universe-common-depend-packages.txt
197
201
# hadolint ignore=SC2002
198
202
RUN --mount=type=ssh \
203
+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
199
204
apt-get update \
200
205
&& cat /tmp/rosdep-universe-common-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
201
- && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME" /.cache
206
+ && /autoware/cleanup_apt.sh
202
207
203
208
# hadolint ignore=SC1091
204
209
RUN --mount=type=cache,target=${CCACHE_DIR} \
@@ -219,7 +224,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
219
224
RUN --mount=type=ssh \
220
225
./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \
221
226
&& pip uninstall -y ansible ansible-core \
222
- && apt-get autoremove -y && rm -rf "$HOME" /.cache
227
+ && /autoware/cleanup_apt.sh true
223
228
224
229
ENTRYPOINT ["/ros_entrypoint.sh" ]
225
230
CMD ["/bin/bash" ]
@@ -233,9 +238,10 @@ ENV CCACHE_DIR="/root/.ccache"
233
238
COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-depend-packages.txt /tmp/rosdep-universe-sensing-perception-depend-packages.txt
234
239
# hadolint ignore=SC2002
235
240
RUN --mount=type=ssh \
241
+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
236
242
apt-get update \
237
243
&& cat /tmp/rosdep-universe-sensing-perception-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
238
- && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME" /.cache
244
+ && /autoware/cleanup_apt.sh
239
245
240
246
# hadolint ignore=SC1091
241
247
RUN --mount=type=cache,target=${CCACHE_DIR} \
@@ -257,9 +263,10 @@ ENV CCACHE_DIR="/root/.ccache"
257
263
COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-depend-packages.txt /tmp/rosdep-universe-sensing-perception-depend-packages.txt
258
264
# hadolint ignore=SC2002
259
265
RUN --mount=type=ssh \
266
+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
260
267
apt-get update \
261
268
&& cat /tmp/rosdep-universe-sensing-perception-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
262
- && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME" /.cache
269
+ && /autoware/cleanup_apt.sh
263
270
264
271
# hadolint ignore=SC1091
265
272
RUN --mount=type=cache,target=${CCACHE_DIR} \
@@ -293,9 +300,10 @@ ENV CCACHE_DIR="/root/.ccache"
293
300
COPY --from=rosdep-universe-localization-mapping-depend /rosdep-universe-localization-mapping-depend-packages.txt /tmp/rosdep-universe-localization-mapping-depend-packages.txt
294
301
# hadolint ignore=SC2002
295
302
RUN --mount=type=ssh \
303
+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
296
304
apt-get update \
297
305
&& cat /tmp/rosdep-universe-localization-mapping-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
298
- && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME" /.cache
306
+ && /autoware/cleanup_apt.sh
299
307
300
308
# hadolint ignore=SC1091
301
309
RUN --mount=type=cache,target=${CCACHE_DIR} \
@@ -314,9 +322,10 @@ ENV CCACHE_DIR="/root/.ccache"
314
322
COPY --from=rosdep-universe-planning-control-depend /rosdep-universe-planning-control-depend-packages.txt /tmp/rosdep-universe-planning-control-depend-packages.txt
315
323
# hadolint ignore=SC2002
316
324
RUN --mount=type=ssh \
325
+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
317
326
apt-get update \
318
327
&& cat /tmp/rosdep-universe-planning-control-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
319
- && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME" /.cache
328
+ && /autoware/cleanup_apt.sh
320
329
321
330
# hadolint ignore=SC1091
322
331
RUN --mount=type=cache,target=${CCACHE_DIR} \
@@ -343,9 +352,10 @@ ENV CCACHE_DIR="/root/.ccache"
343
352
COPY --from=rosdep-universe-vehicle-system-depend /rosdep-universe-vehicle-system-depend-packages.txt /tmp/rosdep-universe-vehicle-system-depend-packages.txt
344
353
# hadolint ignore=SC2002
345
354
RUN --mount=type=ssh \
355
+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
346
356
apt-get update \
347
357
&& cat /tmp/rosdep-universe-vehicle-system-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
348
- && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME" /.cache
358
+ && /autoware/cleanup_apt.sh
349
359
350
360
# hadolint ignore=SC1091
351
361
RUN --mount=type=cache,target=${CCACHE_DIR} \
@@ -369,9 +379,10 @@ ENV CCACHE_DIR="/root/.ccache"
369
379
COPY --from=rosdep-universe-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt
370
380
# hadolint ignore=SC2002
371
381
RUN --mount=type=ssh \
382
+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
372
383
apt-get update \
373
384
&& cat /tmp/rosdep-universe-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
374
- && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME" /.cache
385
+ && /autoware/cleanup_apt.sh
375
386
376
387
COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware
377
388
COPY --from=universe-localization-mapping-devel /opt/autoware /opt/autoware
@@ -402,9 +413,10 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
402
413
COPY --from=rosdep-universe-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt
403
414
# hadolint ignore=SC2002
404
415
RUN --mount=type=ssh \
416
+ --mount=type=cache,target=/var/cache/apt,sharing=locked \
405
417
apt-get update \
406
418
&& cat /tmp/rosdep-universe-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
407
- && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME" /.cache
419
+ && /autoware/cleanup_apt.sh
408
420
409
421
COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware
410
422
COPY --from=universe-devel /opt/autoware /opt/autoware
0 commit comments