Skip to content

Commit 78e1890

Browse files
authored
Fix: Ensure Buildx Builders Are Created or Used for ARM64 and Windows (googleforgames#4115)
1 parent 1e7a8e4 commit 78e1890

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

build/Makefile

+5-6
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,8 @@ build-required-src-dist:
514514
# According to the docker documentation, to build the images for ARM64 arch CPU
515515
# we would need to use buildx command which uses builder https://docs.docker.com/desktop/multi-arch/
516516
# We primarily need this for M1 Macs, see: https://medium.com/geekculture/docker-build-with-mac-m1-d668c802ab96
517-
# Making this command optional (using - as prefix) because it will fail once built for the first time, so we ignore failures.
518517
create-arm64-builder:
519-
-docker buildx create --name $(BUILDX_ARM64_BUILDER)
518+
docker buildx use $(BUILDX_ARM64_BUILDER) || docker buildx create --name $(BUILDX_ARM64_BUILDER) --use
520519

521520
# Build the image for the gameserver controller
522521
build-controller-image: build-controller-image-amd64
@@ -570,8 +569,8 @@ build-agones-sdk-binary-windows: $(ensure-build-image)
570569
$(GO_BUILD_WINDOWS_AMD64) \
571570
-o $(go_build_base_path)/cmd/sdk-server/bin/sdk-server.windows.amd64.exe $(go_rebuild_flags) $(go_version_flags) $(agones_package)/cmd/sdk-server
572571

573-
ensure-windows-buildx-%:
574-
-docker buildx create --name=$(BUILDX_WINDOWS_BUILDER)-$*
572+
ensure-windows-buildx:
573+
docker buildx use $(BUILDX_WINDOWS_BUILDER) || docker buildx create --platform windows/amd64 --name $(BUILDX_WINDOWS_BUILDER) --use
575574

576575
# Build the image for the gameserver extensions
577576
build-extensions-image: build-extensions-image-amd64
@@ -618,8 +617,8 @@ build-agones-sdk-image-windows: build-agones-sdk-binary
618617
build-agones-sdk-image-windows: $(foreach winver, $(WINDOWS_VERSIONS), build-agones-sdk-image-windows-$(winver))
619618

620619
# Build the image for the gameserver sidecar and SDK binaries
621-
build-agones-sdk-image-windows-%: $(ensure-build-image) build-agones-sdk-binary build-licenses build-required-src-dist ensure-windows-buildx-%
622-
docker buildx build --platform windows/amd64 --builder $(BUILDX_WINDOWS_BUILDER)-$* -f $(agones_path)/cmd/sdk-server/Dockerfile.windows --tag=$(sidecar_tag)-windows_amd64-$* --build-arg WINDOWS_VERSION=$* --build-arg IMAGE_TAG=$(if $(filter ltsc2019,$*),$(LTSC2019_IMAGE_TAG)) $(DOCKER_BUILD_ARGS) $(agones_path)/cmd/sdk-server/ $(WINDOWS_DOCKER_PUSH_ARGS)
620+
build-agones-sdk-image-windows-%: $(ensure-build-image) build-agones-sdk-binary build-licenses build-required-src-dist ensure-windows-buildx
621+
docker buildx build --platform windows/amd64 --builder $(BUILDX_WINDOWS_BUILDER) -f $(agones_path)/cmd/sdk-server/Dockerfile.windows --tag=$(sidecar_tag)-windows_amd64-$* --build-arg WINDOWS_VERSION=$* --build-arg IMAGE_TAG=$(if $(filter ltsc2019,$*),$(LTSC2019_IMAGE_TAG)) $(DOCKER_BUILD_ARGS) $(agones_path)/cmd/sdk-server/ $(WINDOWS_DOCKER_PUSH_ARGS)
623622

624623
# Build a static binary for the ping service
625624
build-ping-binary: build-ping-binary-amd64

0 commit comments

Comments
 (0)