agones.dev/agones@v1.53.0/examples/simple-genai-server/Makefile (about)

     1  # Copyright 2024 Google LLC All Rights Reserved.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  #
    16  # Makefile for building a simple-genai-game-server
    17  #
    18  
    19  #  __     __         _       _     _
    20  #  \ \   / /_ _ _ __(_) __ _| |__ | | ___ ___
    21  #   \ \ / / _` | '__| |/ _` | '_ \| |/ _ \ __|
    22  #    \ V / (_| | |  | | (_| | |_) | |  __\__ \
    23  #     \_/ \__,_|_|  |_|\__,_|_.__/|_|\___|___/
    24  #
    25  REPOSITORY ?=
    26  PROD_REPO ?= us-docker.pkg.dev/agones-images/examples
    27  
    28  mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
    29  project_path := $(dir $(mkfile_path))
    30  version := 0.8
    31  ifeq ($(REPOSITORY),)
    32  	server_tag := simple-genai-game-server:$(version)
    33  else
    34  	server_tag := $(REPOSITORY)/simple-genai-game-server:$(version)
    35  endif
    36  server_tag_linux_amd64 = $(server_tag)-linux-amd64
    37  push_server_manifest = $(server_tag_linux_amd64)
    38  root_path = $(realpath $(project_path)/../..)
    39  
    40  #   _____                    _
    41  #  |_   _|_ _ _ __ __ _  ___| |_ ___
    42  #    | |/ _` | '__/ _` |/ _ \ __/ __|
    43  #    | | (_| | | | (_| |  __/ |_\__ \
    44  #    |_|\__,_|_|  \__, |\___|\__|___/
    45  #                 |___/
    46  
    47  build: build-linux-image-amd64
    48  push: push-linux-image-amd64
    49    	# Docker >=24.0.6
    50  	docker buildx imagetools create --tag $(server_tag) \
    51      	$(push_server_manifest)
    52  
    53  # Build a docker image for the server, and tag it
    54  build-linux-image-amd64:
    55  	cd $(root_path) && docker build -f $(project_path)Dockerfile --tag=$(server_tag_linux_amd64) .
    56  
    57  push-linux-image-amd64: build
    58  	docker push $(server_tag_linux_amd64)
    59  
    60  # check if hosted on Google Artifact Registry
    61  gar-check:
    62  	gcloud container images describe $(PROD_REPO)/$(server_tag)
    63  
    64  print-vars:
    65  	$(info project_path is $(project_path))
    66  	$(info server_tag is $(server_tag))
    67  	$(info server_tag_linux_amd64 is $(server_tag_linux_amd64))
    68  	$(info push_server_manifest is $(push_server_manifest))
    69  
    70  # build and push the simple-genai-server image with specified tag
    71  cloud-build:
    72  	cd $(root_path) && gcloud builds submit --config=./examples/simple-genai-server/cloudbuild.yaml