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

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 run apt-get update && apt-get install -y git
workdir /src workdir /src
copy go.mod go.sum ./ 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 . ./ copy . ./
run go test ./... run \
run hack/build ./... --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 from debian:bullseye