build: persist Go build cache across Docker release builds

Mount .gocache/ from the host into the builder container so --rm
container removal no longer wipes GOCACHE between runs.
This commit is contained in:
mixeme
2026-07-26 13:58:26 +03:00
parent 33a246cd13
commit e87840e95b
3 changed files with 7 additions and 0 deletions
+2
View File
@@ -18,12 +18,14 @@ fi
docker build -f Dockerfile -t "$tag" .
mkdir -p "$(dirname "$output")"
mkdir -p "$(pwd)/.gocache"
docker run --rm \
"${docker_user_args[@]}" \
-e "VERSION=${version}" \
-e "OUTPUT=${output}" \
-e "GOCACHE=/tmp/go-build-cache" \
-v "$(pwd):/src" \
-v "$(pwd)/.gocache:/tmp/go-build-cache" \
-w /src \
"$tag" \
bash -c 'CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildvcs=false -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/app.Version=${VERSION}" -o "${OUTPUT}" ./cmd/gosentry'