Skip to content

Commit

Permalink
this will resolve from layer extraction issue on ltsc2019
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutosji committed Jun 17, 2024
1 parent 6bc20a1 commit 5f9cf1a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion examples/simple-game-server/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# Build Stage
ARG WINDOWS_VERSION=ltsc2019
ARG IMAGE_TAG=""

FROM --platform=linux/amd64 golang:1.21.6 as builder
WORKDIR /go/src
Expand All @@ -29,7 +30,7 @@ WORKDIR /go/src/agones.dev/agones/examples/simple-game-server
RUN GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o simple-game-server.exe main.go

RUN ls -ltr /go/src/agones.dev/agones/examples/simple-game-server
FROM mcr.microsoft.com/windows/servercore:${WINDOWS_VERSION}
FROM mcr.microsoft.com/windows/servercore:${WINDOWS_VERSION}${IMAGE_TAG}

WORKDIR /

Expand Down
6 changes: 5 additions & 1 deletion examples/simple-game-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ BUILDX_WINDOWS_BUILDER = windows-builder
# For the full list of tags see https://hub.docker.com/_/microsoft-windows-servercore.
# GKE-Windows version map: https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster-windows#version_mapping
WINDOWS_VERSIONS = ltsc2019 ltsc2022

# https://github.com/microsoft/Windows-Containers/issues/493: Pin the LTSC2019 image to an older sha
LTSC2019_IMAGE_TAG = "@sha256:6fdf140282a2f809dae9b13fe441635867f0a27c33a438771673b8da8f3348a4"

WINDOWS_DOCKER_PUSH_ARGS = # When pushing set to --push.
# Build with Windows support
WITH_WINDOWS ?= 1
Expand Down Expand Up @@ -108,7 +112,7 @@ push-windows-image-%:
build-windows-image-%: ensure-windows-buildx
cd $(root_path) && DOCKER_CLI_EXPERIMENTAL=enabled \
docker buildx build --platform windows/amd64 --builder $(BUILDX_WINDOWS_BUILDER) -f $(project_path)Dockerfile.windows \
--tag=$(server_tag)-windows_amd64-$* --build-arg WINDOWS_VERSION=$* . $(WINDOWS_DOCKER_PUSH_ARGS)
--tag=$(server_tag)-windows_amd64-$* --build-arg WINDOWS_VERSION=$* --build-arg IMAGE_TAG=$(if $(filter ltsc2019,$*),$(LTSC2019_IMAGE_TAG),) . $(WINDOWS_DOCKER_PUSH_ARGS)

ensure-windows-buildx:
# Windows image builds must be directed to a specific buildx context.
Expand Down
3 changes: 2 additions & 1 deletion examples/xonotic/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# See https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility
# for details.
ARG WINDOWS_VERSION=ltsc2019
ARG IMAGE_TAG=""

# Build Stage
FROM --platform=linux/amd64 golang:1.21.6 as base
Expand All @@ -53,7 +54,7 @@ RUN curl -o xonotic.zip https://dl.xonotic.org/xonotic-0.8.6.zip && \


# Final Image
FROM mcr.microsoft.com/windows/servercore:${WINDOWS_VERSION}
FROM mcr.microsoft.com/windows/servercore:${WINDOWS_VERSION}${IMAGE_TAG}

WORKDIR C:/Xonotic

Expand Down
5 changes: 4 additions & 1 deletion examples/xonotic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ PROD_REPO ?= us-docker.pkg.dev/agones-images/examples
WINDOWS_VERSIONS = ltsc2019 ltsc2022
BUILDX_WINDOWS_BUILDER = windows-builder

# https://github.com/microsoft/Windows-Containers/issues/493: Pin the LTSC2019 image to an older sha
LTSC2019_IMAGE_TAG = "@sha256:6fdf140282a2f809dae9b13fe441635867f0a27c33a438771673b8da8f3348a4"

# Build with Windows support
WITH_WINDOWS ?= 1

Expand Down Expand Up @@ -86,7 +89,7 @@ push-windows-image-%:

build-windows-image-%: ensure-windows-buildx
docker buildx build --platform windows/amd64 --builder $(BUILDX_WINDOWS_BUILDER) -f $(project_path)Dockerfile.windows \
--tag=$(server_tag)-windows_amd64-$* --build-arg WINDOWS_VERSION=$* . $(WINDOWS_DOCKER_PUSH_ARGS)
--tag=$(server_tag)-windows_amd64-$* --build-arg WINDOWS_VERSION=$* --build-arg IMAGE_TAG=$(if $(filter ltsc2019,$*),$(LTSC2019_IMAGE_TAG),) . $(WINDOWS_DOCKER_PUSH_ARGS)

ensure-windows-buildx:
# Windows image builds must be directed to a specific buildx context.
Expand Down

0 comments on commit 5f9cf1a

Please sign in to comment.