Skip to content

Commit 48c87a6

Browse files
committed
Compile cAdvisor statically
1 parent 75195c3 commit 48c87a6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

build/build.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ ldflags="
4141
-X ${repo_path}/version.Branch${ldseparator}${branch}
4242
-X ${repo_path}/version.BuildUser${ldseparator}${USER}@${host}
4343
-X ${repo_path}/version.BuildDate${ldseparator}${build_date}
44-
-X ${repo_path}/version.GoVersion${ldseparator}${go_version}"
44+
-X ${repo_path}/version.GoVersion${ldseparator}${go_version}
45+
-extldflags \"-static\""
4546

4647
echo " > cadvisor"
47-
godep go build -ldflags "${ldflags}" -o cadvisor${ext} ${repo_path}
48+
godep go build --ldflags "${ldflags}" -o cadvisor${ext} ${repo_path}
4849

4950
exit 0

integration/runner/runner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func Run() error {
204204

205205
// Build cAdvisor.
206206
glog.Infof("Building cAdvisor...")
207-
err := RunCommand("godep", "go", "build", "github.com/google/cadvisor")
207+
err := RunCommand("godep", "go", "build", "--ldflags", "-extldflags '-static'", "github.com/google/cadvisor")
208208
if err != nil {
209209
return err
210210
}

0 commit comments

Comments
 (0)