Skip to content

Commit

Permalink
Use shared git for Go
Browse files Browse the repository at this point in the history
  • Loading branch information
sixeyed committed Dec 29, 2024
1 parent 8822233 commit f5e04ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
20 changes: 10 additions & 10 deletions build/compose-images-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 4 additions & 16 deletions images/golang/windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/

0 comments on commit f5e04ec

Please sign in to comment.