koki / short

Manageable Kubernetes manifests through a composable, reusable syntax
https://docs.koki.io/short
Apache License 2.0
122 stars 14 forks source link

Add script for creating kokster_gox container #174

Closed wlan0 closed 6 years ago

wlan0 commented 6 years ago

Just found out that the binary created using gox is not statically compiled. Please fix asap.

ublubu commented 6 years ago

Just tried gox again with the right ldflags:

GOOS=linux GOARCH=amd64 ./scripts/build.sh
mv bin/short bin/short_linux_amd64_
# and short_linux_386_, short_darwin_amd64_, short_darwin_386_

docker run -v $GOPATH:/go -t kokster/gox gox -ldflags "-X github.com/koki/short/cmd.GITCOMMIT=$VERSION -extldflags -static -w" -output="src/github.com/koki/short/bin/short_{{.OS}}_{{.Arch}}" -os="linux darwin" -arch="386 amd64" github.com/koki/short

And the result is:

bin/short_darwin_386:    Mach-O i386 executable
bin/short_darwin_386_:   Mach-O i386 executable
bin/short_darwin_amd64:  Mach-O 64-bit x86_64 executable
bin/short_darwin_amd64_: Mach-O 64-bit x86_64 executable
bin/short_linux_386:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
bin/short_linux_386_:    ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
bin/short_linux_amd64:   ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not stripped
bin/short_linux_amd64_:  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped

Seems gox doesn't honor the static-linking flags on linux amd64, so we should just use go build (which you've already modified the release script to do).