Improved Makefile and Dockerfile

This commit is contained in:
Jakub Al-Khalili 2019-07-09 11:46:26 +02:00
parent cc32111a51
commit 99e2308264
2 changed files with 4 additions and 5 deletions

View File

@ -42,7 +42,6 @@ RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s
RUN export GO111MODULE=auto
RUN mkdir -p $GOPATH/src/github.com/jenkinsci/kubernetes-operator
ADD . $GOPATH/src/github.com/jenkinsci/kubernetes-operator
WORKDIR $GOPATH/src/github.com/jenkinsci/kubernetes-operator
RUN mkdir -p /home/builder

View File

@ -416,19 +416,19 @@ endif
@echo
.PHONY: image
image: ## Create the docker image from the Dockerfile
image: ## Create the docker image from the Dockerfile. This image is used to build linux binary regardless of the system on the host
@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 .
-t jenkins-operator/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
indocker: minikube-run image ## Run make in a docker container
@echo "+ $@"
docker run --rm -it $(DOCKER_FLAGS) \
-v /var/run/docker.sock:/var/run/docker.sock \
@ -437,4 +437,4 @@ indocker: image ## Run make in a docker container
--mount type=bind,source=$(HOME)/.kube,target=/home/builder/.kube \
-e DOCKER_HOST=$(DOCKER_HOST_IP) \
-e MINIKUBE_IP=$(MINIKUBE_IP) \
infrastructure/runner
jenkins-operator/runner