Files
helmfile/Makefile
T
Cedric Meury 5f9d3f818c 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
2018-04-27 11:11:35 +02:00

64 lines
1.4 KiB
Makefile

ORG ?= $(shell basename $(realpath ..))
PKGS := $(shell go list ./... | grep -v /vendor/)
build:
go build ${TARGETS}
.PHONY: build
generate:
go generate ${PKGS}
.PHONY: generate
fmt:
go fmt ${PKGS}
.PHONY: fmt
check:
go vet ${PKGS}
.PHONY: check
test:
go test -v ${PKGS} -cover -race -p=1
.PHONY: test
integration:
bash test/integration/run.sh
.PHONY: integration
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
pristine: generate fmt
git ls-files --exclude-standard --modified --deleted --others | diff /dev/null -
.PHONY: pristine
release: pristine cross
@ghr -b ${BODY} -t ${GITHUB_TOKEN} -u ${ORG} -recreate ${TAG} dist
.PHONY: release
image:
docker build -t quay.io/${ORG}/helmfile:${TAG} .
run: image
docker run --rm -it -t quay.io/${ORG}/helmfile:${TAG} sh
push: image
docker push quay.io/${ORG}/helmfile:${TAG}
tools:
go get -u github.com/tcnksm/ghr github.com/mitchellh/gox
.PHONY: tools
TAG = $(shell git describe --tags --abbrev=0 HEAD)
LAST = $(shell git describe --tags --abbrev=0 HEAD^)
BODY = "`git log ${LAST}..HEAD --oneline --decorate` `printf '\n\#\#\# [Build Info](${BUILD_URL})'`"