Skip to content

Commit

Permalink
chore(build): only enable cgo for ci/prod builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Jan 9, 2020
1 parent cbafe15 commit a863eb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a863eb6

Please sign in to comment.