From 1f6e705cbe127af6dda136e4c854cfd3ab3c2c6f Mon Sep 17 00:00:00 2001 From: WeebDataHoarder Date: Wed, 23 Apr 2025 07:54:49 +0200 Subject: [PATCH] docker: reproducible builds within docker --- .drone.jsonnet | 5 ++++- .drone.yml | 14 +++++++++++++- Dockerfile | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 8544105..961c90e 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -67,7 +67,10 @@ local Publish(registry, repo, secret, go, alpine, os, arch, trigger, platforms, image: "plugins/buildx", privileged: true, environment: { - DOCKER_BUILDKIT: "1" + DOCKER_BUILDKIT: "1", + SOURCE_DATE_EPOCH: 0, + TZ: "UTC", + LC_ALL: "C", }, settings: { registry: registry, diff --git a/.drone.yml b/.drone.yml index 12ea62e..9b3af25 100644 --- a/.drone.yml +++ b/.drone.yml @@ -89,6 +89,9 @@ platform: steps: - environment: DOCKER_BUILDKIT: "1" + LC_ALL: C + SOURCE_DATE_EPOCH: 0 + TZ: UTC image: plugins/buildx name: docker privileged: true @@ -126,6 +129,9 @@ platform: steps: - environment: DOCKER_BUILDKIT: "1" + LC_ALL: C + SOURCE_DATE_EPOCH: 0 + TZ: UTC image: plugins/buildx name: docker privileged: true @@ -163,6 +169,9 @@ platform: steps: - environment: DOCKER_BUILDKIT: "1" + LC_ALL: C + SOURCE_DATE_EPOCH: 0 + TZ: UTC image: plugins/buildx name: docker privileged: true @@ -200,6 +209,9 @@ platform: steps: - environment: DOCKER_BUILDKIT: "1" + LC_ALL: C + SOURCE_DATE_EPOCH: 0 + TZ: UTC image: plugins/buildx name: docker privileged: true @@ -230,6 +242,6 @@ trigger: type: docker --- kind: signature -hmac: 6df9c42b8cc689f661dc3612f39f5ffce2dea2f50a92e45355fed1d882ee8c5a +hmac: d487230b53d511ea07b872c70e0d3c21a3b7883d960e4011bc402c3467196baa ... diff --git a/Dockerfile b/Dockerfile index 15afbea..4be17fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ ENV GOOS=${TARGETOS} ENV GOARCH=${TARGETARCH} ENV GOTOOLCHAIN=${GOTOOLCHAIN} -RUN go build -pgo=auto -v -trimpath -o "${GOBIN}/go-away" ./cmd/go-away +RUN go build -pgo=auto -v -trimpath -ldflags=-buildid= -o "${GOBIN}/go-away" ./cmd/go-away RUN test -e "${GOBIN}/go-away"