build consistent statically linked binary for docker image

* use golang 1.10.1 images everywhere
* introduce a `static-linux` target to build a statically linked 64-bit binary only
* use that binary for the official image and the circle build and tests
* use a multi-stage dockerfile for a consistent build environment
This commit is contained in:
Cedric Meury
2018-04-27 11:11:35 +02:00
parent efe5a2e56b
commit 5f9d3f818c
3 changed files with 23 additions and 7 deletions
+5 -1
View File
@@ -29,6 +29,10 @@ cross:
gox -os '!freebsd !netbsd' -arch '!arm' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags '-X main.Version=${TAG}' ${TARGETS}
.PHONY: cross
static-linux:
env CGO_ENABLED=0 gox -osarch="linux/amd64" -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags '-X main.Version=${TAG}' ${TARGETS}
.PHONY: linux
clean:
rm dist/helmfile_*
.PHONY: clean
@@ -41,7 +45,7 @@ release: pristine cross
@ghr -b ${BODY} -t ${GITHUB_TOKEN} -u ${ORG} -recreate ${TAG} dist
.PHONY: release
image: cross
image:
docker build -t quay.io/${ORG}/helmfile:${TAG} .
run: image