From 3a93e28605ae6b64f0e854fd4601ac814517cb94 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 17 Jun 2023 16:22:50 +0200 Subject: [PATCH] CI: Remove .dockerignore to ensure reproducible builds Since go 1.18, built binaries also include VCS information such as the built commit. This information is also included in the official binaries. To ensure that the Docker container recreates the same binaries, the .git folder must also be transferred into the container. Thus, remove the .dockerignore file. The copied files must also be owned by the current user within the container, as git refuses to work otherwise. --- .dockerignore | 11 ----------- docker/Dockerfile.release | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index b7f28c69f..000000000 --- a/.dockerignore +++ /dev/null @@ -1,11 +0,0 @@ -# Folders -.git/ -.github/ -changelog/ -doc/ -docker/ - -# Files -.gitignore -.golangci.yml -*.md diff --git a/docker/Dockerfile.release b/docker/Dockerfile.release index 01f9df150..ccf80376a 100644 --- a/docker/Dockerfile.release +++ b/docker/Dockerfile.release @@ -5,7 +5,7 @@ FROM --platform=linux/amd64 restic/builder:latest as helper ARG TARGETOS ARG TARGETARCH -COPY . /restic +COPY --chown=build . /restic RUN go run helpers/build-release-binaries/main.go --platform $TARGETOS/$TARGETARCH --skip-compress RUN mv /output/restic_${TARGETOS}_${TARGETARCH} /output/restic