Skip to content

Commit 90a85a4

Browse files
committed
tools: try to be better caching container layers
Signed-off-by: Ramon Roche <[email protected]>
1 parent 72d7ac1 commit 90a85a4

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

Tools/setup/Dockerfile

+4-9
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,25 @@ ENV DISPLAY=:99
99
ENV TERM=xterm
1010
ENV TZ=UTC
1111
ENV QEMU_CPU=max,pauth-impdef=on
12+
ENV RUNS_IN_DOCKER=true
1213

1314
# SITL UDP PORTS
1415
EXPOSE 14556/udp
1516
EXPOSE 14557/udp
1617

17-
# Set Up Caching of APT packages
18-
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
19-
--mount=type=cache,target=/var/lib/apt,sharing=locked \
20-
rm -f /etc/apt/apt.conf.d/docker-clean && \
21-
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
22-
apt-get --quiet -y update
23-
2418
# Install Shell Script Entrypoint
2519
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
2620

2721
# Install PX4 Requirements
2822
COPY requirements.txt /tmp/requirements.txt
2923
COPY ubuntu.sh /tmp/ubuntu.sh
30-
RUN touch /.dockerenv
24+
3125
RUN bash /tmp/ubuntu.sh --no-sim-tools
3226

27+
# Make sure git is ok with your local copy
3328
RUN git config --global --add safe.directory '*'
3429

35-
# create user with id 1001 (jenkins docker workflow default)
30+
# Create user with id 1001 (jenkins docker workflow default)
3631
RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user
3732

3833
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

Tools/setup/ubuntu.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ do
2828
done
2929

3030
echo "[ubuntu.sh] Starting..."
31-
echo "[ubuntu.sh] arch: ${GREEN}$INSTALL_ARCH${NC}"
31+
echo "[ubuntu.sh] arch: $INSTALL_ARCH"
3232

3333
# detect if running in docker
34-
if [ -f /.dockerenv ]; then
34+
if [ -z "$RUNS_IN_DOCKER" ]; then
3535
echo "[ubuntu.sh] Running within docker, installing initial dependencies";
3636
apt-get --quiet -y update && DEBIAN_FRONTEND=noninteractive apt-get --quiet -y install \
3737
ca-certificates \
@@ -58,7 +58,7 @@ fi
5858
# check ubuntu version
5959
# otherwise warn and point to docker?
6060
UBUNTU_RELEASE="`lsb_release -rs`"
61-
echo "[ubuntu.sh] Ubuntu ${GREEN}${UBUNTU_RELEASE}${NC}"
61+
echo "[ubuntu.sh] Ubuntu ${UBUNTU_RELEASE}"
6262
echo "[ubuntu.sh] Installing PX4 general dependencies"
6363

6464
sudo apt-get update -y --quiet

0 commit comments

Comments
 (0)