From 1dce3ab2b11c594c549af0cb84500e83cb34ae0f Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Mon, 13 Jan 2025 17:50:20 +0100 Subject: [PATCH] build(docker/backend): use cache mounts for apt-installs --- docker/backend/Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docker/backend/Dockerfile b/docker/backend/Dockerfile index 5e79a48ca..563e15917 100644 --- a/docker/backend/Dockerfile +++ b/docker/backend/Dockerfile @@ -6,16 +6,24 @@ FROM ${FROM_IMG}:${FROM_TAG} ENV LANG=de_DE.UTF-8 # compile-time dependencies -RUN apt-get -y update && apt-get install -y libpq-dev libsodium-dev +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ +--mount=type=cache,target=/var/lib/apt,sharing=locked \ +apt-get -y update && apt-get install -y libpq-dev libsodium-dev # RUN apt-get -y update && apt-get -y install llvm # RUN apt-get -y update && apt-get -y install g++ libghc-zlib-dev libpq-dev libsodium-dev pkg-config # RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata -RUN apt-get -y update && apt-get install -y --no-install-recommends locales locales-all +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ +--mount=type=cache,target=/var/lib/apt,sharing=locked \ +apt-get -y update && apt-get install -y --no-install-recommends locales locales-all # run-time dependencies for uniworx binary -RUN apt-get -y update && apt-get -y install fonts-roboto +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ +--mount=type=cache,target=/var/lib/apt,sharing=locked \ +apt-get -y update && apt-get -y install fonts-roboto # RUN apt-get -y update && apt-get -y install pdftk -RUN apt-get -y update && apt-get -y install texlive-latex-recommended texlive-luatex texlive-plain-generic texlive-lang-german texlive-lang-english +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ +--mount=type=cache,target=/var/lib/apt,sharing=locked \ +apt-get -y update && apt-get -y install texlive-latex-recommended texlive-luatex texlive-plain-generic texlive-lang-german texlive-lang-english # locally these two should be identical, so that compilation results are written out into the file dir. # in CI-pipelines these two should be different, so that the container caches the compilation results.