Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Commit 15cf108

Browse files
authored
chore(ci): add docker build cache (#805)
1 parent 10b4a35 commit 15cf108

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/workflows/docker.yml

+23-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: "Push docker image to GAR"
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [ main ]
66
tags:
77
- "v*"
88

@@ -40,9 +40,31 @@ jobs:
4040
type=ref,event=tag
4141
type=sha
4242
43+
- name: Cache Go build
44+
uses: actions/cache@v4
45+
with:
46+
enableCrossOsArchive: true
47+
path: |
48+
go-build-platforms
49+
key: ${{ runner.os }}-go_build-platforms
50+
restore-keys: |
51+
${{ runner.os }}-go_build-platforms
52+
53+
- name: Inject cache into docker
54+
uses: reproducible-containers/[email protected]
55+
with:
56+
cache-map: |
57+
{
58+
"go-build-platforms": "/root/.cache/go-build"
59+
}
60+
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
61+
4362
- name: Build and push
4463
uses: docker/build-push-action@v2
4564
with:
65+
context: .
66+
cache-from: type=gha
67+
cache-to: type=gha,mode=max
4668
platforms: linux/amd64,linux/arm64
4769
push: true
4870
tags: ${{ steps.meta.outputs.tags }}

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ RUN apk update && apk add --no-cache --update gcc musl-dev linux-headers git mak
44

55
WORKDIR /taiko-client
66
COPY . .
7-
RUN make build
7+
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
8+
make build
89

910
FROM alpine:latest
1011

0 commit comments

Comments
 (0)