Skip to content

Commit 865df56

Browse files
committed
Add caching steps for UV and APT in CI pipeline
Introduce caching for UV and APT files to optimize Docker builds. Use `actions/cache` for storing cache and `buildkit-cache-dance` for injecting caches into the build process. This reduces redundant downloads, improving CI efficiency and build speeds.
1 parent e5b6734 commit 865df56

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/ci-pipeline.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,42 @@ jobs:
117117
images: |
118118
${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.IMAGE_NAME }}-${{ matrix.docker_target }}
119119
120+
- name: UV Build Caches for Docker
121+
id: docker-build-uv-cache
122+
uses: actions/cache@v4
123+
with:
124+
path: |
125+
home-nonroot-cache-uv
126+
key: cache-uv-${{ hashFiles('uv.lock') }}
127+
128+
- name: APT Build Caches for Docker APT
129+
id: docker-build-apt-cache
130+
uses: actions/cache@v4
131+
with:
132+
path: |
133+
var-cache-apt
134+
var-lib-apt
135+
key: cache-apt-${{ hashFiles('Dockerfile') }}
136+
137+
- name: Inject UV cache in docker
138+
uses: reproducible-containers/[email protected]
139+
with:
140+
cache-map: |
141+
{
142+
"home-nonroot-cache-uv": "/home/nonroot/.cache/uv"
143+
}
144+
skip-extraction: ${{ steps.docker-build-uv-cache.outputs.cache-hit }}
145+
146+
- name: Inject APT cache in docker
147+
uses: reproducible-containers/[email protected]
148+
with:
149+
cache-map: |
150+
{
151+
"var-cache-apt": "/var/cache/apt",
152+
"var-lib-apt": "/var/lib/apt",
153+
}
154+
skip-extraction: ${{ steps.docker-build-apt-cache.outputs.cache-hit }}
155+
120156
# This build an image WITHOUT tags and outputs the digests, so that we can aggragate them later
121157
- name: Build and push production image
122158
id: build-and-push

0 commit comments

Comments
 (0)