Skip to content

Commit 22e8ec9

Browse files
feat(ci,Dockerfile): add caching of build directories (#14)
* feat(ci,Dockerfile): add caching of build directories * chore: update python:3.12.5-alpine docker digest to aeff643 * chore: update python:3.12.5-alpine docker digest to bb5d0ac * chore: update python docker tag to v3.12.6 * chore: update python:3.12.6-alpine docker digest to 7130f75 --------- Co-authored-by: Renovate Bot <[email protected]>
1 parent 24769fb commit 22e8ec9

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

.github/workflows/docker-publish.yml

+40
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,46 @@ jobs:
4646
type=ref,event=tag
4747
type=raw,value=latest,enable={{is_default_branch}}
4848
49+
- name: Setup buildx mount cache
50+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
51+
with:
52+
path: |
53+
home-cache-386
54+
home-cache-amd64
55+
home-cache-armv6
56+
home-cache-armv7
57+
home-cache-arm64
58+
key: buildx-mount-cache-${{ github.sha }}
59+
restore-keys: |
60+
buildx-mount-cache-
61+
62+
- name: Inject buildx mount cache into docker
63+
uses: reproducible-containers/buildkit-cache-dance@5b6db76d1da5c8b307d5d2e0706d266521b710de # v3.1.2
64+
with:
65+
cache-map: |
66+
{
67+
"home-cache-386": {
68+
"target": "/root/.cache",
69+
"id": "home-cache-linux/386"
70+
},
71+
"home-cache-amd64": {
72+
"target": "/root/.cache",
73+
"id": "home-cache-linux/amd64"
74+
},
75+
"home-cache-armv6": {
76+
"target": "/root/.cache",
77+
"id": "home-cache-linux/arm/v6"
78+
},
79+
"home-cache-armv7": {
80+
"target": "/root/.cache",
81+
"id": "home-cache-linux/arm/v7"
82+
},
83+
"home-cache-arm64": {
84+
"target": "/root/.cache",
85+
"id": "home-cache-linux/arm64"
86+
}
87+
}
88+
4989
- name: Build and push Docker image
5090
id: build-and-push
5191
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0

Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
FROM python:3.12.5-alpine@sha256:c2f41e6a5a67bc39b95be3988dd19fbd05d1b82375c46d9826c592cca014d4de
1+
FROM python:3.12.6-alpine@sha256:7130f75b1bb16c7c5d802782131b4024fe3d7a87ce7d936e8948c2d2e0180bc4
22

33
# renovate: datasource=repology depName=alpine_3_20/fuse versioning=loose
44
ARG FUSE_VERSION="2.9.9-r5"
55

6+
ARG TARGETPLATFORM
7+
68
WORKDIR /app
79

810
ADD requirements.txt .
911

10-
RUN apk add --no-cache \
12+
RUN --mount=type=cache,sharing=locked,target=/root/.cache,id=home-cache-$TARGETPLATFORM \
13+
apk add --no-cache \
1114
fuse=${FUSE_VERSION} \
1215
&& \
1316
sed -i 's/#user_allow_other/user_allow_other/g' /etc/fuse.conf && \
1417
pip install -r requirements.txt && \
15-
rm -rf /root/.cache /root/.cargo
18+
chown -R nobody:nogroup /app
1619

1720
COPY --chown=nobody:nogroup . .
1821

0 commit comments

Comments
 (0)