File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ BINARY_DEST_DIR := image/bin
1616build : check-docker
1717 for i in $( BINARIES) ; do \
1818 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -v -ldflags ' -s' -o $(BINARY_DEST_DIR ) /$$ i bin/$$ i.go || exit 1; \
19+ $(call check-static-binary,$(BINARY_DEST_DIR ) /$$i) \
1920 done
2021 docker build -t $(IMAGE ) image
2122
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ BINARY_DEST_DIR = image/bin
1414
1515build : check-docker
1616 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -v -ldflags ' -s' -o $(BINARY_DEST_DIR ) /boot main.go || exit 1
17+ $(call check-static-binary,$(BINARY_DEST_DIR ) /boot)
1718 docker build -t $(BUILD_IMAGE ) .
1819 docker cp ` docker run -d $( BUILD_IMAGE) ` :/usr/local/bin/redis-server $(BINARY_DEST_DIR ) /
1920 docker build -t $(IMAGE ) image
Original file line number Diff line number Diff line change @@ -48,3 +48,13 @@ check-deisctl:
4848 @if [ -z $$ (which deisctl) ]; then \
4949 echo " Missing \` deisctl\` utility, please install from https://github.com/deis/deis" ; \
5050 fi
51+
52+ define check-static-binary
53+ if file $(1 ) | grep -q "statically linked"; then \
54+ echo -n ""; \
55+ else \
56+ echo "The binary file $(1 ) is not statically linked. Build canceled"; \
57+ exit 1; \
58+ fi
59+ endef
60+
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ BINARY_DEST_DIR = image/bin
1515
1616build : check-docker
1717 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -v -ldflags ' -s' -o $(BINARY_DEST_DIR ) /logger github.com/deis/deis/logger || exit 1
18+ $(call check-static-binary,$(BINARY_DEST_DIR ) /logger)
1819 docker build -t $(IMAGE ) image
1920
2021clean : check-docker check-registry
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ DEV_DOCKER_IMAGE := $(DEV_REGISTRY)/$(RELEASE_IMAGE)
1414
1515build : check-docker
1616 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -v -ldflags ' -s' -o image/logspout
17+ $(call check-static-binary,image/logspout)
1718 docker build -t $(RELEASE_IMAGE ) image
1819
1920clean :
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ BINARY_DEST_DIR = image/bin
1515
1616build : check-docker
1717 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -v -ldflags ' -s' -o $(BINARY_DEST_DIR ) /publisher github.com/deis/deis/publisher || exit 1
18+ $(call check-static-binary,$(BINARY_DEST_DIR ) /publisher)
1819 docker build -t $(RELEASE_IMAGE ) image
1920
2021clean : check-docker check-registry
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ build: check-docker
1717 docker build -t $(BUILD_IMAGE ) .
1818 docker cp ` docker run -d $( BUILD_IMAGE) ` :/nginx.tgz image/
1919 docker cp ` docker run -d $( BUILD_IMAGE) ` :/go/bin/boot image/bin/
20+ $(call check-static-binary,image/bin/boot)
2021 docker build -t $(IMAGE ) image
2122 rm image/nginx.tgz
2223 rm image/bin/boot
You can’t perform that action at this time.
0 commit comments