Skip to content

Commit

Permalink
Merge pull request #317 from Praqma/fix_docker
Browse files Browse the repository at this point in the history
Fix the docker build
  • Loading branch information
luisdavim authored Oct 23, 2019
2 parents 23bd4f0 + 8cbe6ef commit f66322b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
15 changes: 0 additions & 15 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ ifeq ($(strip $(GOPATH)),)
endif

SRCDIR := $(GOPATH)/src/
PRJDIR := $(CURDIR)

ifeq ($(filter $(GOPATH)%,$(CURDIR)),)
GOPATH := $(shell mktemp -d "/tmp/dep.XXXXXXXX")
SRCDIR := $(GOPATH)/src/
PRJDIR := $(SRCDIR)helmsman
endif

ifneq ($(OS),Windows_NT)
Expand Down Expand Up @@ -56,42 +58,42 @@ $(SRCDIR):
@ln -s $(CURDIR) $(SRCDIR)

dep: $(SRCDIR) ## Ensure vendors with dep
@cd $(SRCDIR)helmsman && \
@cd $(PRJDIR) && \
dep ensure
.PHONY: dep

dep-update: $(SRCDIR) ## Ensure vendors with dep
@cd $(SRCDIR)helmsman && \
@cd $(PRJDIR) && \
dep ensure --update
.PHONY: dep-update

build: dep ## Build the package
@cd $(SRCDIR)helmsman && \
@cd $(PRJDIR) && \
CGO_ENABLED=0 go build -ldflags '-X main.version="${TAG}-${DATE}" -extldflags "-static"'

generate:
@go generate #${PKGS}
.PHONY: generate

check: $(SRCDIR)
@cd $(SRCDIR)helmsman && \
@cd $(PRJDIR) && \
dep check && \
go vet #${PKGS}
.PHONY: check

test: dep ## Run unit tests
@cd $(SRCDIR)helmsman && \
@cd $(PRJDIR) && \
helm init --client-only && \
CGO_ENABLED=0 go test -v -cover -p=1 -args -f example.toml
.PHONY: test

cross: dep ## Create binaries for all OSs
@cd $(SRCDIR)helmsman && \
@cd $(PRJDIR) && \
env CGO_ENABLED=0 gox -os '!freebsd !netbsd' -arch '!arm' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags '-X main.Version=${TAG}-${DATE}'
.PHONY: cross

release: dep ## Generate a new release
@cd $(SRCDIR)helmsman && \
@cd $(PRJDIR) && \
goreleaser --release-notes release-notes.md --rm-dist

tools: ## Get extra tools used by this makefile
Expand Down
5 changes: 1 addition & 4 deletions dockerfile/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ RUN cd helmsman \
&& LT_SHA=$(git rev-parse ${LastTag}^{}) \
&& LC_SHA=$(git rev-parse HEAD) \
&& if [ ${LT_SHA} != ${LC_SHA} ]; then TAG=latest-$(date +"%d%m%y"); fi \
&& dep ensure \
&& make build
# && CGO_ENABLED=0 GOOS=linux go install -a -ldflags '-X main.version='$TAG' -extldflags "-static"' .


# The image to keep
FROM alpine:3.10
Expand All @@ -41,7 +38,7 @@ RUN apk --no-cache update \
&& rm -rf /tmp/linux-amd64 \
&& chmod +x /usr/local/bin/helm

COPY --from=builder /go/bin/helmsman /bin/helmsman
COPY --from=builder /go/src/helmsman/helmsman /bin/helmsman

RUN mkdir -p ~/.helm/plugins \
&& helm plugin install https://github.com/hypnoglow/helm-s3.git \
Expand Down

0 comments on commit f66322b

Please sign in to comment.