From 932f30e730a90bf02a896bdb150150fe0b4e4d19 Mon Sep 17 00:00:00 2001 From: Evan Cordell Date: Thu, 9 Jan 2020 16:39:38 -0500 Subject: [PATCH] chore(build): only enable cgo for ci/prod builds --- Dockerfile | 2 +- Makefile | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6c2f4bad41..62478a132e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ COPY cmd cmd COPY test test COPY go.mod go.mod COPY go.sum go.sum -RUN make build +RUN CGO_ENABLED=1 make build FROM openshift/origin-base diff --git a/Makefile b/Makefile index e324f706db..2b06ff5620 100644 --- a/Makefile +++ b/Makefile @@ -73,14 +73,16 @@ build-linux: clean $(CMDS) build-wait: clean bin/wait bin/wait: - CGO_ENABLED=1 CGO_DEBUG=1 GOOS=linux GOARCH=386 go build -o $@ $(PKG)/test/e2e/wait + GOOS=linux GOARCH=386 go build -o $@ $(PKG)/test/e2e/wait $(CMDS): version_flags=-ldflags "-X $(PKG)/pkg/version.GitCommit=$(GIT_COMMIT) -X $(PKG)/pkg/version.OLMVersion=`cat OLM_VERSION`" $(CMDS): - CGO_ENABLED=1 CGO_DEBUG=1 $(arch_flags) go $(build_cmd) $(MOD_FLAGS) $(version_flags) -o bin/$(shell basename $@) $@ + $(arch_flags) go $(build_cmd) $(MOD_FLAGS) $(version_flags) -o bin/$(shell basename $@) $@ + +build: clean $(CMDS) $(TCMDS): - CGO_ENABLED=0 go test -c $(BUILD_TAGS) $(MOD_FLAGS) -o bin/$(shell basename $@) $@ + go test -c $(BUILD_TAGS) $(MOD_FLAGS) -o bin/$(shell basename $@) $@ run-local: build-linux build-wait rm -rf build