From 572385eeda638c1e0bb75c0bcd60f9a80e321db8 Mon Sep 17 00:00:00 2001 From: Frederic Leger Date: Tue, 24 Dec 2024 16:38:11 +0100 Subject: [PATCH] chore: better caching of docker build --- .github/workflows/__shared-ci.yml | 2 +- Dockerfile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/__shared-ci.yml b/.github/workflows/__shared-ci.yml index ffa9394..fff540f 100644 --- a/.github/workflows/__shared-ci.yml +++ b/.github/workflows/__shared-ci.yml @@ -111,7 +111,7 @@ jobs: script: | const builtImages = JSON.parse(process.env.BUILT_IMAGES); const tags = builtImages.app.images.join(','); - const digest = builtImages.app.digests[0]; + const digest = builtImages.app.digests[0].includes('@') ? builtImages.app.digests[0].split('@')[1] : ''; core.setOutput('tags', tags); core.setOutput('digest', digest); env: diff --git a/Dockerfile b/Dockerfile index 11639d7..f0fdc34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,15 @@ FROM python:3.12-slim-bullseye AS builder # hadolint ignore=DL3008 -RUN set -eux; export DEBIAN_FRONTEND=noninteractive; \ +RUN --mount=type=cache,target=/var/cache/apt \ + set -eux; export DEBIAN_FRONTEND=noninteractive; \ apt-get update; \ apt-get install -y --no-install-recommends build-essential gcc WORKDIR /build COPY requirements.txt requirements.txt + # hadolint ignore=DL3042 RUN --mount=type=cache,target=~/.cache/pip \ pip install --user -r requirements.txt