From 6c5d3e71e55ea1884de7de11830dc3842326f31b Mon Sep 17 00:00:00 2001 From: Martin Maly Date: Thu, 3 Feb 2022 14:21:19 -0800 Subject: [PATCH] Build Function Runner Docker Image --- porch/Makefile | 2 +- porch/func/Makefile | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/porch/Makefile b/porch/Makefile index 5edcc0bcb4..7e95d934a6 100644 --- a/porch/Makefile +++ b/porch/Makefile @@ -70,7 +70,7 @@ start-kube-apiserver: .PHONY: start-function-runner start-function-runner: - cd func; docker buildx build -t function-runner . + $(MAKE) -C ./func build-image docker stop function-runner || true docker rm -f function-runner || true docker run --detach \ diff --git a/porch/func/Makefile b/porch/func/Makefile index 7c7a481319..7c6eba62af 100644 --- a/porch/func/Makefile +++ b/porch/func/Makefile @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +GCP_PROJECT_ID ?= $(shell gcloud config get-value project) +IMAGE_TAG ?= latest +IMAGE_REPO ?= gcr.io/$(GCP_PROJECT_ID) +IMAGE_NAME ?= function-runner COMPILED_PROTO=evaluator/evaluator_grpc.pb.go evaluator/evaluator.pb.go all: $(COMPILED_PROTO) @@ -23,3 +27,11 @@ $(COMPILED_PROTO): evaluator/evaluator.proto --go_out=./evaluator --go_opt=paths=source_relative \ --go-grpc_out=./evaluator --go-grpc_opt=paths=source_relative \ ./evaluator/evaluator.proto + +.PHONY: build-image +build-image: + docker buildx build --tag $(IMAGE_NAME):$(IMAGE_TAG) --tag $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) . + +.PHONY: push-image +push-image: + docker buildx build --push --tag $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) . \ No newline at end of file