diff --git a/.circleci/config.yml b/.circleci/config.yml index 94be15a4..43b027fb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ jobs: build: docker: - - image: circleci/golang:1.10 + - image: circleci/golang:1.10.1 working_directory: /go/src/github.com/roboll/helmfile steps: - checkout @@ -16,7 +16,7 @@ jobs: test: docker: - - image: circleci/golang:1.10 + - image: circleci/golang:1.10.1 working_directory: /go/src/github.com/roboll/helmfile steps: - checkout @@ -76,7 +76,7 @@ jobs: release: docker: - - image: circleci/golang:1.10 + - image: circleci/golang:1.10.1 working_directory: /go/src/github.com/roboll/helmfile steps: - checkout @@ -84,7 +84,6 @@ jobs: - run: command: | docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" quay.io - make tools BUILD_URL="$CIRCLE_BUILD_URL" make push release workflows: diff --git a/Dockerfile b/Dockerfile index 656b39bc..54fbd16d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,12 @@ +FROM golang:1.10.1-alpine3.7 as builder + +RUN apk add --no-cache make git +WORKDIR /go/src/github.com/roboll/helmfile/ +COPY . /go/src/github.com/roboll/helmfile/ +RUN make static-linux + +# ----------------------------------------------------------------------------- + FROM alpine:3.7 RUN apk add --no-cache ca-certificates @@ -11,6 +20,6 @@ RUN wget ${HELM_LOCATION}/${HELM_FILENAME} && \ tar zxf ${HELM_FILENAME} && mv /linux-amd64/helm /usr/local/bin/ && \ rm ${HELM_FILENAME} && rm -r /linux-amd64 -COPY dist/helmfile_linux_amd64 /usr/local/bin/helmfile +COPY --from=builder /go/src/github.com/roboll/helmfile/dist/helmfile_linux_amd64 /usr/local/bin/helmfile CMD ["/usr/local/bin/helmfile"] diff --git a/Makefile b/Makefile index 60ffd1f2..a940657d 100644 --- a/Makefile +++ b/Makefile @@ -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 GOOS=linux GOARCH=amd64 go build -o "dist/helmfile_linux_amd64" -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