Browse Source

Merge pull request #801 from dotcloud/build_docker_static

* Makefile: Add link flags in order to link statically and without debug symbols
Victor Vieux 12 years ago
parent
commit
5ccde4dffc
2 changed files with 3 additions and 3 deletions
  1. 2 2
      Makefile
  2. 1 1
      packaging/ubuntu/Makefile

+ 2 - 2
Makefile

@@ -17,7 +17,7 @@ endif
 GIT_COMMIT = $(shell git rev-parse --short HEAD)
 GIT_STATUS = $(shell test -n "`git status --porcelain`" && echo "+CHANGES")
 
-BUILD_OPTIONS = -ldflags "-X main.GITCOMMIT $(GIT_COMMIT)$(GIT_STATUS)"
+BUILD_OPTIONS = -a -ldflags "-X main.GITCOMMIT $(GIT_COMMIT)$(GIT_STATUS) -d -w"
 
 SRC_DIR := $(GOPATH)/src
 
@@ -33,7 +33,7 @@ all: $(DOCKER_BIN)
 
 $(DOCKER_BIN): $(DOCKER_DIR)
 	@mkdir -p  $(dir $@)
-	@(cd $(DOCKER_MAIN); go build $(GO_OPTIONS) $(BUILD_OPTIONS) -o $@)
+	@(cd $(DOCKER_MAIN); CGO_ENABLED=0 go build $(GO_OPTIONS) $(BUILD_OPTIONS) -o $@)
 	@echo $(DOCKER_BIN_RELATIVE) is created.
 
 $(DOCKER_DIR):

+ 1 - 1
packaging/ubuntu/Makefile

@@ -15,7 +15,7 @@ VERSION=$(shell sed -En '0,/^\#\# /{s/^\#\# ([^ ]+).+/\1/p}' ../../CHANGELOG.md)
 
 all:
 	# Compile docker. Used by dpkg-buildpackage.
-	cd src/${GITHUB_PATH}/docker; GOPATH=${CURDIR} go build
+	cd src/${GITHUB_PATH}/docker; GOPATH=${CURDIR} CGO_ENABLED=0 go build -a -ldflags '-d -w'
 
 install:
 	# Used by dpkg-buildpackage