Added docker goal to Makefile

This commit is contained in:
Jakub Al-Khalili 2019-07-08 15:14:44 +02:00
parent 4329881788
commit 12bd6b0d54
2 changed files with 24 additions and 0 deletions

View File

@ -390,3 +390,27 @@ endif
@echo "Dependencies:"
go mod vendor -v
@echo
.PHONY: image
image: ## Create the docker image from the Dockerfile
@echo "+ $@"
docker build --rm --force-rm --no-cache \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg MINIKUBE_VERSION=$(MINIKUBE_VERSION) \
--build-arg OPERATOR_SDK_VERSION=$(OPERATOR_SDK_VERSION) \
-t infrastructure/runner .
.PHONY: indocker
PWD := $(shell pwd)
DOCKER_HOST_IP := $(shell minikube docker-env | grep DOCKER_HOST | cut -d '"' -f 2)
MINIKUBE_IP := $(shell minikube ip)
indocker: image ## Run make in a docker container
@echo "+ $@"
docker run --rm -it $(DOCKER_FLAGS) \
-v /var/run/docker.sock:/var/run/docker.sock \
--mount type=bind,source=$(PWD),target=/go/src/github.com/jenkinsci/kubernetes-operator \
--mount type=bind,source=$(HOME)/.minikube,target=/minikube \
--mount type=bind,source=$(HOME)/.kube,target=/home/builder/.kube \
-e DOCKER_HOST=$(DOCKER_HOST_IP) \
-e MINIKUBE_IP=$(MINIKUBE_IP) \
infrastructure/runner

0
entrypoint.sh Normal file → Executable file
View File