docker: update & use build cache

This commit is contained in:
Mikaël Cluseau 2024-01-07 10:56:42 +01:00
parent 4f48866daa
commit b5b7272603
1 changed files with 14 additions and 4 deletions

View File

@ -1,12 +1,22 @@
# ------------------------------------------------------------------------
from golang:1.21.4-bullseye as build
from golang:1.21.5-bullseye as build
run apt-get update && apt-get install -y git
workdir /src
copy go.mod go.sum ./
run go mod download
run \
--mount=type=cache,id=gomod,target=/go/pkg/mod \
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \
go mod download
copy . ./
run go test ./...
run hack/build ./...
run \
--mount=type=cache,id=gomod,target=/go/pkg/mod \
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \
go test ./... && \
hack/build ./...
# ------------------------------------------------------------------------
from debian:bullseye