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

chore(ci): add docker build cache #805

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading