@@ -7,18 +7,22 @@ ARG USER_UID=1000
7
7
8
8
# Upgrade packages
9
9
# Ref: https://pythonspeed.com/articles/security-updates-in-docker/
10
- RUN apt-get update && apt-get upgrade -y \
10
+ # Ref: https://docs.docker.com/build/cache/#use-the-dedicated-run-cache
11
+ RUN --mount=type=cache,target=/var/cache/apt \
12
+ apt-get update && apt-get upgrade -y \
11
13
&& rm -rf /var/lib/apt/lists/*
12
14
13
15
# Install sudo and create a user with sudo privileges
14
16
# Ref: https://stackoverflow.com/a/65434659
15
- RUN apt-get update && apt-get install -y sudo \
17
+ RUN --mount=type=cache,target=/var/cache/apt \
18
+ apt-get update && apt-get install -y sudo \
16
19
&& useradd -m -s /bin/bash -u $USER_UID -G sudo $USERNAME \
17
20
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
18
21
&& rm -rf /var/lib/apt/lists/*
19
22
20
23
# Install common tools
21
- RUN apt-get update && apt-get install -y \
24
+ RUN --mount=type=cache,target=/var/cache/apt \
25
+ apt-get update && apt-get install -y \
22
26
curl \
23
27
git \
24
28
htop \
@@ -34,16 +38,19 @@ RUN apt-get update && apt-get install -y \
34
38
&& rm -rf /var/lib/apt/lists/*
35
39
36
40
# Install Python pip
37
- RUN apt-get update && apt-get install -y python3-pip \
41
+ RUN --mount=type=cache,target=/var/cache/apt \
42
+ apt-get update && apt-get install -y \
38
43
&& rm -rf /var/lib/apt/lists/*
39
44
40
45
# Install custom tools
41
- RUN apt-get update && apt-get install -y \
46
+ RUN --mount=type=cache,target=/var/cache/apt \
47
+ apt-get update && apt-get install -y \
42
48
git-extras \
43
49
&& rm -rf /var/lib/apt/lists/*
44
50
45
51
# Install ROS2 RVIZ and Gazebo
46
- RUN apt-get update && apt-get install -y \
52
+ RUN --mount=type=cache,target=/var/cache/apt \
53
+ apt-get update && apt-get install -y \
47
54
ros-$ROS_DISTRO-gazebo-ros-pkgs \
48
55
ros-$ROS_DISTRO-rviz2 \
49
56
&& rm -rf /var/lib/apt/lists/*
0 commit comments