diff --git a/Makefile b/Makefile index 0564917..93017df 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ DOCKER_REPO ?= docker.io/ IMAGE ?= $(USER)/tomcat-operator -TAG ?= v0.0.3 +TAG ?= $(shell git rev-parse HEAD) PROG := tomcat-operator .DEFAULT_GOAL := help @@ -25,6 +25,11 @@ build: tidy unit-test ## image Create the Docker image of the operator image: build docker build -t "$(DOCKER_REPO)$(IMAGE):$(TAG)" . -f build/Dockerfile + $(MAKE) tag + +## tag Tag the image as latest +tag: + docker tag "$(DOCKER_REPO)$(IMAGE):$(TAG)" "$(DOCKER_REPO)$(IMAGE):latest" ## push Push Docker image to the docker.io repository. push: image diff --git a/deploy/operator.yaml b/deploy/operator.yaml index 39fabae..918a143 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -16,7 +16,7 @@ spec: containers: - name: tomcat-operator # Replace this with the built image name - image: docker.io/jfclere/tomcat-operator:v0.0.3 + image: docker.io/jfclere/tomcat-operator:latest command: - tomcat-operator imagePullPolicy: IfNotPresent diff --git a/pkg/controller/tomcat/tomcat_controller.go b/pkg/controller/tomcat/tomcat_controller.go index 806871c..f58838f 100644 --- a/pkg/controller/tomcat/tomcat_controller.go +++ b/pkg/controller/tomcat/tomcat_controller.go @@ -284,6 +284,7 @@ func (r *ReconcileTomcat) deploymentForTomcat(t *tomcatv1alpha1.Tomcat) *appsv1. InitContainers: []corev1.Container{{ Name: "war", Image: t.Spec.WebArchiveImage, + ImagePullPolicy: "IfNotPresent", Command: []string{ "./mavenbuilder.sh", t.Spec.WebAppURL,