Skip to content

Commit

Permalink
🩹 Downgrade git from v2.47.1.windows.1 to v2.47.0.windows.2 (#12)
Browse files Browse the repository at this point in the history
* 🩹 Pin git version in server image to 2.47.0.2

See package definition
https://github.com/microsoft/winget-pkgs/blob/master/manifests/g/Git/Git/2.47.0.2/Git.Git.installer.yaml

* 🩹 Manually install mingit and git lfs in servercore image

* 🧹 Use / in paths instead of \
  • Loading branch information
s-weigand authored Jan 13, 2025
1 parent 49a3357 commit e12c653
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
5 changes: 3 additions & 2 deletions docker/Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ LABEL org.opencontainers.image.source=https://github.com/s-weigand/uv-windows-do

RUN winget.exe install --id "Git.Git" --exact --source winget `
--accept-source-agreements --disable-interactivity --silent `
--accept-package-agreements --force
--accept-package-agreements --force `
--version 2.47.0.2

RUN git config --global init.defaultBranch main

RUN irm https://astral.sh/uv/$env:UV_VERSION/install.ps1 | iex
RUN $env:Path = 'C:\Users\ContainerAdministrator\.local\bin;' + $env:Path
RUN $env:Path = 'C:/Users/ContainerAdministrator/.local/bin;' + $env:Path

RUN uv python install $env:PYTHON_VERSIONS.split(' ')
23 changes: 20 additions & 3 deletions docker/Dockerfile.servercore
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,34 @@ RUN New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

RUN $vcRedistUrl='https://aka.ms/vs/17/release/vc_redist.x64.exe'; `
$installerPath='C:\vc_redist.x64.exe'; `
$installerPath='C:/vc_redist.x64.exe'; `
(New-Object System.Net.WebClient).DownloadFile($vcRedistUrl, $installerPath); `
Start-Process -FilePath $installerPath -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; `
Remove-Item -Path $installerPath -Force

COPY --from=ghcr.io/s-weigand/mingit:ltsc2022 C:/git C:/git
RUN $downloadUrl='https://github.com/git-for-windows/git/releases/download/v2.47.0.windows.2/MinGit-2.47.0.2-64-bit.zip'; `
$artifactPath='C:/mingit.zip'; `
(New-Object System.Net.WebClient).DownloadFile($downloadUrl, $artifactPath); `
Expand-Archive -Path $artifactPath -DestinationPath C:/git; `
Remove-Item -Path $artifactPath -Force

RUN $downloadUrl='https://github.com/git-lfs/git-lfs/releases/download/v3.6.0/git-lfs-windows-amd64-v3.6.0.zip'; `
$artifactPath='C:/git-lfs.zip'; `
$tmpExtractFolder='c:/tmp/git-lfs-3.6.0'; `
(New-Object System.Net.WebClient).DownloadFile($downloadUrl, $artifactPath); `
Expand-Archive -Path $artifactPath -DestinationPath C:/tmp; `
Remove-Item -Path $artifactPath -Force; `
Copy-Item "$tmpExtractFolder/git-lfs.exe" 'c:/git/cmd/git-lfs.exe'; `
# Disable error about missing file, we can't view it in the container anyway due to the missing browser
New-Item 'C:/git/mingw64/share/doc/git-doc/git-lfs.html' -Force; `
Remove-Item -Path $tmpExtractFolder -Recurse -Force

RUN [Environment]::SetEnvironmentVariable('PATH', [Environment]::GetEnvironmentVariable('PATH') + ';C:/git/cmd;C:/git/mingw64/bin;C:/git/usr/bin', 'Machine')
RUN $env:Path = 'C:/git/cmd;C:/git/mingw64/bin;C:/git/usr/bin;' + $env:Path
RUN git config --global init.defaultBranch main
RUN git lfs install

RUN irm https://astral.sh/uv/$env:UV_VERSION/install.ps1 | iex
RUN $env:Path = 'C:\Users\ContainerAdministrator\.local\bin;' + $env:Path
RUN $env:Path = 'C:/Users/ContainerAdministrator/.local/bin;' + $env:Path

RUN uv python install $env:PYTHON_VERSIONS.split(' ')

0 comments on commit e12c653

Please sign in to comment.