Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build static binaries for Docker, so that we can use 'scratch' image #1766

Merged
merged 2 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

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