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

Commit

Permalink
add docker build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp committed May 7, 2024
1 parent 4ab635c commit cb6e9b2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Push docker image to GAR"

on:
push:
branches: [main]
branches: [ main ]
tags:
- "v*"

Expand Down Expand Up @@ -40,9 +40,31 @@ jobs:
type=ref,event=tag
type=sha
- name: Cache Go build
uses: actions/cache@v4
with:
enableCrossOsArchive: true
path: |
go-build-platforms
key: ${{ runner.os }}-go_build-platforms
restore-keys: |
${{ runner.os }}-go_build-platforms
- name: Inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"go-build-platforms": "/root/.cache/go-build"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ RUN apk update && apk add --no-cache --update gcc musl-dev linux-headers git mak

WORKDIR /taiko-client
COPY . .
RUN make build
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
make build

FROM alpine:latest

Expand Down

0 comments on commit cb6e9b2

Please sign in to comment.