agones.dev/agones@v1.53.0/build/includes/allocation.mk (about)

     1  # Copyright 2019 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  #         ____  ____   ____   _____           _ _	
    17  #    __ _|  _ \|  _ \ / ___| |_   _|__   ___ | (_)_ __   __ _	
    18  #   / _` | |_) | |_) | |       | |/ _ \ / _ \| | | '_ \ / _` |	
    19  #  | (_| |  _ <|  __/| |___    | | (_) | (_) | | | | | | (_| |	
    20  #   \__, |_| \_\_|    \____|   |_|\___/ \___/|_|_|_| |_|\__, |	
    21  #   |___/                                               |___/ 
    22  
    23  # Calculate sha hash of sha hashes of all files in a specified ALLOCATION_FOLDER
    24  allocation_build_folder = build-allocation-images/
    25  sdk_build_folder = build-sdk-images
    26  build_allocation_version = $(call sha_dir,$(build_path)/$(allocation_build_folder)/$(ALLOCATION_FOLDER)/*)
    27  build_allocation_prefix = agones-build-allocation-
    28  ALLOCATION_FOLDER ?= go
    29  ALLOCATION_IMAGE_TAG=$(build_allocation_prefix)$(ALLOCATION_FOLDER):$(build_allocation_version)
    30  
    31  .PHONY: gen-allocation-grpc 
    32  
    33  # create the build image allocation if it doesn't exist
    34  ensure-build-allocation-image:
    35  	$(MAKE) ensure-image IMAGE_TAG=$(ALLOCATION_IMAGE_TAG) BUILD_TARGET=build-build-allocation-image ALLOCATION_FOLDER=$(ALLOCATION_FOLDER)
    36  
    37  # Builds the docker image
    38  # Note: allocation and sdk use the same dockerfile
    39  build-build-allocation-image: ensure-build-sdk-image-base
    40  	docker build --tag=$(ALLOCATION_IMAGE_TAG) --build-arg BASE_IMAGE=$(build_sdk_base_tag) -f $(build_path)$(sdk_build_folder)/$(ALLOCATION_FOLDER)/Dockerfile $(build_path)$(allocation_build_folder)$(ALLOCATION_FOLDER)
    41  
    42  # Generates grpc server and client for a single allocation, use ALLOCATION_FOLDER variable to specify the allocation folder.
    43  gen-allocation-grpc:
    44  	cd $(allocation_build_folder); \
    45  	cd - ; \
    46  	$(MAKE) ensure-build-allocation-image ALLOCATION_FOLDER=$(ALLOCATION_FOLDER) ; \
    47  	docker run --rm $(common_mounts) -e "VERSION=$(VERSION)" $(ALLOCATION_IMAGE_TAG) gen