Skip to content

Commit

Permalink
Refactor proxies section
Browse files Browse the repository at this point in the history
I learned how to Makefile
  • Loading branch information
Aergonus authored and asobti committed Jul 18, 2018
1 parent 7a8da4c commit 188cd28
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,29 @@ endif
build: clean gofmt lint
$(ENVVAR) go build -o kube-monkey

# Supressing docker build avoids printing the env variables
container: test
proxies:
ifneq ($(and $(http_proxy), $(https_proxy)),)
@echo Starting Docker build, importing both http_proxy and https_proxy env variables
@docker build --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) -t kube-monkey:$(TAG) .
dockerbuild=docker build --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy)
else
ifdef http_proxy
@echo Starting Docker build, importing http_proxy
@docker build --build-arg http_proxy=$(http_proxy) -t kube-monkey:$(TAG) .
dockerbuild= docker build --build-arg http_proxy=$(http_proxy)
else
ifdef https_proxy
@echo Starting Docker build, importing https_proxy
@docker build --build-arg https_proxy=$(https_proxy) -t kube-monkey:$(TAG) .
dockerbuild= docker build --build-arg https_proxy=$(https_proxy)
else
@echo no env proxies set, building normally
docker build -t kube-monkey:$(TAG) .
dockerbuild= docker build -t kube-monkey:$(TAG) .
endif
endif
endif

# Supressing docker build avoids printing the env variables
container: proxies test
@$(dockerbuild) -t kube-monkey:$(TAG) .

gofmt:
find . -path ./vendor -prune -o -name '*.go' -print | xargs -L 1 -I % gofmt -s -w %

Expand Down

0 comments on commit 188cd28

Please sign in to comment.