From dfb21a55f3c0c79a27d7bbf0484bcc0902541c7c Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Fri, 4 Jun 2021 16:25:05 +0200 Subject: [PATCH 1/2] Build static binaries for Docker, so that we can use the 'stratch' image. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 62553326c4..13b13c4dc4 100644 --- a/Makefile +++ b/Makefile @@ -98,9 +98,9 @@ ci: build-ci test lint-ci # to be run in Docker build build-revad-docker: off - go build -ldflags ${BUILD_FLAGS} -o ./cmd/revad/revad ./cmd/revad + env CGO_ENABLED=0 go build -ldflags ${BUILD_FLAGS} -o ./cmd/revad/revad ./cmd/revad build-reva-docker: off - go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva + env CGO_ENABLED=0 go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva clean: rm -rf dist From 520f98834c5c270586cbba659e344498c8481e34 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Tue, 8 Jun 2021 20:14:53 +0200 Subject: [PATCH 2/2] add changelog entry --- changelog/unreleased/set-cgo-enabled-0-flag.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changelog/unreleased/set-cgo-enabled-0-flag.md diff --git a/changelog/unreleased/set-cgo-enabled-0-flag.md b/changelog/unreleased/set-cgo-enabled-0-flag.md new file mode 100644 index 0000000000..5ea66fc500 --- /dev/null +++ b/changelog/unreleased/set-cgo-enabled-0-flag.md @@ -0,0 +1,8 @@ +Bugfix: Set CGO_ENABLED flag for 'scratch' based docker builds + +The CGO_ENABLED=0 flag was added to the docker build flags so that it will +produce a static build. This allows usage of the 'scratch' image for +reduction of the docker image size. + +https://github.com/cs3org/reva/issues/1765 +https://github.com/cs3org/reva/pull/1766 \ No newline at end of file