diff --git a/Dockerfile b/Dockerfile index 063d34af..5681134f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,3 @@ -FROM golang:1.12.4-alpine3.9 as builder - -RUN apk add --no-cache make git -WORKDIR /workspace/helmfile -COPY . /workspace/helmfile -RUN make static-linux - -# ----------------------------------------------------------------------------- - FROM alpine:3.8 RUN apk add --no-cache ca-certificates git bash curl jq @@ -36,6 +27,6 @@ RUN helm plugin install https://github.com/databus23/helm-diff && \ helm plugin install https://github.com/hypnoglow/helm-s3.git && \ helm plugin install https://github.com/aslafy-z/helm-git.git -COPY --from=builder /workspace/helmfile/dist/helmfile_linux_amd64 /usr/local/bin/helmfile +COPY dist/helmfile_linux_amd64 /usr/local/bin/helmfile CMD ["/usr/local/bin/helmfile"] diff --git a/Makefile b/Makefile index e2c08807..fe1a673b 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ integration: .PHONY: integration cross: - env CGO_ENABLED=0 gox -os '!openbsd !freebsd !netbsd' -arch '!arm !mips !mipsle !mips64 !mips64le' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags '-X main.Version=${TAG}' ${TARGETS} + env CGO_ENABLED=0 gox -os '!openbsd !freebsd !netbsd' -arch '!arm !mips !mipsle !mips64 !mips64le !s390x' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags '-X main.Version=${TAG}' ${TARGETS} .PHONY: cross static-linux: @@ -50,9 +50,13 @@ release: pristine cross @ghr -b ${BODY} -t ${GITHUB_TOKEN} -u ${ORG} -recreate ${TAG} dist .PHONY: release -image: +image: static-linux/in-docker docker build -t quay.io/${ORG}/helmfile:${TAG} . +static-linux/in-docker: + if [ -f dist/helmfile_linux_amd64 ]; then echo removing dist/helmfile_linux_amd64; rm dist/helmfile_linux_amd64; fi + docker run -v $(HOME)/go:/go -v $(PWD):/workspace/helmfile -w /workspace/helmfile golang:1.12.4-alpine3.9 sh -c 'apk add --no-cache make git && make static-linux' + run: image docker run --rm -it -t quay.io/${ORG}/helmfile:${TAG} sh