Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the docker build #317

Merged
merged 1 commit into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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