From f5e04ec09caf3afba990db50be10aee70ea3e847 Mon Sep 17 00:00:00 2001 From: Elton Stoneman Date: Sun, 29 Dec 2024 19:29:00 +0000 Subject: [PATCH] Use shared git for Go --- build/compose-images-windows.yml | 20 ++++++++++---------- images/golang/windows/Dockerfile | 20 ++++---------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/build/compose-images-windows.yml b/build/compose-images-windows.yml index 3b57c3d..8bed9bf 100644 --- a/build/compose-images-windows.yml +++ b/build/compose-images-windows.yml @@ -28,6 +28,16 @@ services: build: context: ../images/openjdk/windows + git-windows: + image: diamol/git-windows:2e + build: + context: ../images/git-windows + args: + WINDOWS_VERSION: ${WINDOWS_VERSION} + GIT_WINDOWS_VERSION: ${GIT_WINDOWS_VERSION} + GIT_WINDOWS_RELEASE_NUMBER: ${GIT_WINDOWS_RELEASE_NUMBER} + GIT_WINDOWS_DOWNLOAD_SHA256: ${GIT_WINDOWS_DOWNLOAD_SHA256} + golang: build: context: ../images/golang/windows @@ -83,16 +93,6 @@ services: WINDOWS_VERSION: ${WINDOWS_VERSION} GRAFANA_WINDOWS_DOWNLOAD_SHA256: ${GRAFANA_WINDOWS_DOWNLOAD_SHA256} - git-windows: - image: diamol/git-windows:2e - build: - context: ../images/git-windows - args: - WINDOWS_VERSION: ${WINDOWS_VERSION} - GIT_WINDOWS_VERSION: ${GIT_WINDOWS_VERSION} - GIT_WINDOWS_RELEASE_NUMBER: ${GIT_WINDOWS_RELEASE_NUMBER} - GIT_WINDOWS_DOWNLOAD_SHA256: ${GIT_WINDOWS_DOWNLOAD_SHA256} - gogs: build: context: ../images/gogs/windows diff --git a/images/golang/windows/Dockerfile b/images/golang/windows/Dockerfile index cf3f5fc..8cc31f7 100644 --- a/images/golang/windows/Dockerfile +++ b/images/golang/windows/Dockerfile @@ -1,21 +1,9 @@ #escape=` -ARG WINDOWS_VERSION -ARG GOLANG_VERSION # Git -FROM mcr.microsoft.com/windows/servercore:${WINDOWS_VERSION} as git-installer -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ARG GIT_VERSION -ARG GIT_WINDOWS_RELEASE_NUMBER -ARG GIT_WINDOWS_DOWNLOAD_SHA256 - -RUN Write-Host "Downloading Git version: $($env:GIT_VERSION), release: $($env:GIT_WINDOWS_RELEASE_NUMBER)"; ` - Invoke-WebRequest -OutFile git.zip -Uri "https://github.com/git-for-windows/git/releases/download/v$($env:GIT_VERSION).windows.$($env:GIT_WINDOWS_RELEASE_NUMBER)/MinGit-$($env:GIT_VERSION)-64-bit.zip" - -RUN if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_WINDOWS_DOWNLOAD_SHA256) {exit 1}; ` - Expand-Archive -Path git.zip -DestinationPath C:\git; ` - Remove-Item git.zip -Force +ARG WINDOWS_VERSION +ARG GOLANG_VERSION +FROM diamol/git-windows:2e-windows-${WINDOWS_VERSION}-amd64 AS git # Golang ARG GOLANG_VERSION @@ -25,7 +13,7 @@ ENV CGO_ENABLED=0 USER ContainerAdministrator RUN setx /M PATH "%PATH%;C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;" -COPY --from=git-installer /git/ /git +COPY --from=git /git/ /git # create commands which alias Linux names COPY ./aliases/ /Windows/System32/ \ No newline at end of file