Skip to content

Commit

Permalink
Fix apt cache not being properly utilized in Dockerfile (mastodon#28115)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmstan authored Nov 28, 2023
1 parent 7a3b41e commit c40cfc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 3 additions & 1 deletion streaming/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down

0 comments on commit c40cfc5

Please sign in to comment.