From c40cfc5d0905651dcf3c1e5fa04c0bd06da6e9d1 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Tue, 28 Nov 2023 16:23:44 -0600 Subject: [PATCH] Fix apt cache not being properly utilized in Dockerfile (#28115) --- Dockerfile | 4 ++-- streaming/Dockerfile | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 73267f38064..ed5ebf1e0aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,6 +70,8 @@ ARG TARGETPLATFORM RUN echo "Target platform is $TARGETPLATFORM" RUN \ +# Remove automatic apt cache Docker cleanup scripts + rm -f /etc/apt/apt.conf.d/docker-clean; \ # Sets timezone echo "${TZ}" > /etc/localtime; \ # Creates mastodon user/group and sets home directory @@ -127,7 +129,6 @@ RUN \ --mount=type=cache,id=apt-cache-${TARGETPLATFORM},target=/var/cache/apt,sharing=locked \ --mount=type=cache,id=apt-lib-${TARGETPLATFORM},target=/var/lib/apt,sharing=locked \ # Install build tools and bundler dependencies from APT - apt-get update; \ apt-get install -y --no-install-recommends \ g++ \ gcc \ @@ -221,7 +222,6 @@ RUN \ --mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \ --mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \ # Apt update install non-dev versions of necessary components - apt-get update; \ apt-get install -y --no-install-recommends \ libssl3 \ libpq5 \ diff --git a/streaming/Dockerfile b/streaming/Dockerfile index ee62e9ec73d..6e0a84771c1 100644 --- a/streaming/Dockerfile +++ b/streaming/Dockerfile @@ -47,6 +47,8 @@ ARG TARGETPLATFORM RUN echo "Target platform is ${TARGETPLATFORM}" RUN \ +# Remove automatic apt cache Docker cleanup scripts + rm -f /etc/apt/apt.conf.d/docker-clean; \ # Sets timezone echo "${TZ}" > /etc/localtime; \ # Creates mastodon user/group and sets home directory @@ -60,7 +62,7 @@ RUN \ # Mount Apt cache and lib directories from Docker buildx caches --mount=type=cache,id=apt-cache-${TARGETPLATFORM},target=/var/cache/apt,sharing=locked \ --mount=type=cache,id=apt-lib-${TARGETPLATFORM},target=/var/lib/apt,sharing=locked \ -# upgrade to check for security updates to Debian image +# Upgrade to check for security updates to Debian image apt-get update; \ apt-get dist-upgrade -yq; \ apt-get install -y --no-install-recommends \