Skip to content

Instantly share code, notes, and snippets.

@lrvick

lrvick/Makefile

Created Aug 16, 2019
Embed
What would you like to do?
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
userid = $(shell id -u)
groupid = $(shell id -g)
image = "bitgo/$(current_dir):latest"
default: build
lint: helm-lint
fetch: submodule-update
latest: submodule-latest build
shell: minikube-start image
@$(contain) shell
build: minikube-start fetch image
mkdir build/tools && \
docker cp $(image):/usr/local/bin/* build/tools/
contain := \
eval $$(build/tools/minikube docker-env) && \
minikube ssh docker run \
-it \
--rm \
--privileged \
-h "$(current_dir)" \
-v $(PWD)/charts:/home/build/charts \
-v $(PWD)/packages:/home/build/packages \
-v $(PWD)/scripts:/home/build/scripts \
-u $(userid):$(groupid) \
$(image)
minikube := \
$(PWD)/build/tools/minikube -p "$(current_dir)"
tools:
mkdir -p build/tools && \
docker cp
minikube-start: minikube-install
$(minikube) start
( $(minikube) mount $(PWD):/home/docker/$(current_dir) & )
minikube-stop:
$(minikube) stop
minikube-shell:
@$(minikube) ssh
minikube-install:
$(PWD)/scripts/minikube-install.sh
image:
$(minikube) ssh "cd $(current_dir) && docker ps"
$(minikube) ssh "cd $(current_dir) && docker build \
--build-arg UID=$(userid) \
--build-arg GID=$(groupid) \
-t $(image) ."
submodule-update:
git submodule update --init --recursive
submodule-latest:
git submodule foreach 'git checkout master && git pull'
helm-lint:
helm lint charts/*/
clean: minikube-stop
$(minikube) delete
rm -rf build
.DEFAULT_GOAL := default
.PHONY: lint build fetch latest shell contain image submodule-update submodule-latest shell helm-lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.