release: skip downloading go modules in container image builds (#821)

So that the release process can be (probably) 2x faster
This commit is contained in:
KUOKA Yusuke 2019-08-24 10:29:26 +09:00 committed by GitHub
parent b58e082a8f
commit ba0891b7b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 12 deletions

View File

@ -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"]

View File

@ -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