From: Kiran Kamineni Date: Fri, 9 Mar 2018 19:49:24 +0000 (-0800) Subject: Making the build completely static for docker X-Git-Tag: 2.0.0-ONAP~53 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F71%2F37271%2F1;p=aaf%2Fsms.git Making the build completely static for docker Making the build static is good for deployment on a container. There is no need to worry about installing dependencies and so on. Issue-ID: AAF-182 Change-Id: I6bb34ccae423886d9154b2a713b81911f739e9ff Signed-off-by: Kiran Kamineni --- diff --git a/sms-service/src/sms/Makefile b/sms-service/src/sms/Makefile index 2751fff..25c12e1 100644 --- a/sms-service/src/sms/Makefile +++ b/sms-service/src/sms/Makefile @@ -1,5 +1,6 @@ GOPATH := $(shell realpath "$(PWD)/../../") BINARY := sms +PLATFORM := linux DEPENDENCIES := github.com/golang/dep/cmd/dep export GOPATH ... @@ -8,7 +9,9 @@ all: test build deploy: test build build: deps format - go build -o $(GOPATH)/target/$(BINARY) -v sms.go + CGO_ENABLED=0 GOOS=$(PLATFORM) go build -a \ + -ldflags '-extldflags "-static"' \ + -o $(GOPATH)/target/$(BINARY) -v sms.go clean: go clean