Skip to content

Commit

Permalink
Build static binaries for Docker, so that we can use 'scratch' image (c…
Browse files Browse the repository at this point in the history
…s3org#1766)

* Build static binaries for Docker, so that we can use the 'stratch' image.
* add changelog entry
  • Loading branch information
ylebre authored Jun 14, 2021
1 parent 1ca0cfc commit 07adb3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,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

Expand Down
8 changes: 8 additions & 0 deletions changelog/unreleased/set-cgo-enabled-0-flag.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 07adb3f

Please sign in to comment.