From 04d7f24e0f529b31e834a38dd68797a3151be4a7 Mon Sep 17 00:00:00 2001 From: Iris Date: Wed, 5 Jun 2024 23:26:03 -0700 Subject: [PATCH] add docker build and push target for GMC (#83) * add docker build and push target for GMC Signed-off-by: irisdingbj --- microservices-connector/Makefile | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/microservices-connector/Makefile b/microservices-connector/Makefile index cb560076..69ab07d7 100644 --- a/microservices-connector/Makefile +++ b/microservices-connector/Makefile @@ -2,8 +2,10 @@ # SPDX-License-Identifier: Apache-2.0 # Image URL to use all building/pushing image targets -CTR_IMG ?= gmcmanager:latest -ROUTER_IMG ?= gmcrouter:latest +CTR_IMG ?= gmcmanager +ROUTER_IMG ?= gmcrouter +VERSION ?= latest +DOCKER_REGISTRY ?= docker.io/opea # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.29.0 @@ -111,18 +113,26 @@ run-router: manifests generate fmt vet ## Build manager and router Docker images -.PHONY: docker -docker: manager-image router-image +.PHONY: docker.build +docker.build: manager-image router-image # Build manager Docker image manager-image: @echo "Building manager Docker image..." - $(CONTAINER_TOOL) build -t ${CTR_IMG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile.manager . + $(CONTAINER_TOOL) build -t $(DOCKER_REGISTRY)/${CTR_IMG}:$(VERSION) -f Dockerfile.manager . # Build router Docker image router-image: @echo "Building router Docker image..." - $(CONTAINER_TOOL) build -t ${ROUTER_IMG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile.router . + $(CONTAINER_TOOL) build -t $(DOCKER_REGISTRY)/${ROUTER_IMG}:$(VERSION) -f Dockerfile.router . + +# Publish manager and router docker images +.PHONY: docker.push +docker.push: + @echo "Push manager Docker image..." + $(CONTAINER_TOOL) push $(DOCKER_REGISTRY)/${CTR_IMG}:$(VERSION) + @echo "Push router Docker image..." + $(CONTAINER_TOOL) push $(DOCKER_REGISTRY)/${ROUTER_IMG}:$(VERSION) ## Clean up build binaries