Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update git for windows #21

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions docker/Dockerfile.windows.1803

This file was deleted.

29 changes: 17 additions & 12 deletions docker/Dockerfile.windows.1809
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# escape=`
FROM mcr.microsoft.com/powershell:nanoserver-1809
USER ContainerAdministrator

FROM mcr.microsoft.com/windows/servercore:1809 AS git
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV PATH="$PATH;C:\git\cmd" `
GIT_VERSION="2.23.0.1"

RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/MinGit-2.21.0-64-bit.zip -OutFile git.zip; `
Expand-Archive git.zip -DestinationPath C:\git;
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

FROM mcr.microsoft.com/powershell:nanoserver-1809
COPY --from=git /git /git
RUN $major, $minor, $patch, $build = $env:GIT_VERSION.split('.'); `
if ($build -ne '1') { `
$exePath = ('MinGit-{0}.{1}.{2}.{3}-busybox-64-bit.zip' -f $major, $minor, $patch, $build); `
} `
else { `
$exePath = ('MinGit-{0}.{1}.{2}-busybox-64-bit.zip' -f $major, $minor, $patch); `
} `
$url = ('https://github.com/git-for-windows/git/releases/download/v{0}.{1}.{2}.windows.{3}/{4}' -f $major, $minor, $patch, $build, $exePath); `
Invoke-WebRequest -UseBasicParsing $url -OutFile git.zip; `
Expand-Archive git.zip -DestinationPath C:\git; `
Remove-Item git.zip; `
git --version;

ADD windows/* /bin/

# https://github.com/PowerShell/PowerShell/issues/6211#issuecomment-367477137
USER ContainerAdministrator
RUN setx /M PATH "%PATH%;C:\Program Files\PowerShell"

SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
CMD [ "pwsh", "C:\\bin\\clone.ps1" ]
29 changes: 17 additions & 12 deletions docker/Dockerfile.windows.1903
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# escape=`
FROM mcr.microsoft.com/powershell:nanoserver-1903
USER ContainerAdministrator

FROM mcr.microsoft.com/windows/servercore:1903 AS git
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV PATH="$PATH;C:\git\cmd" `
GIT_VERSION="2.23.0.1"

RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/MinGit-2.21.0-64-bit.zip -OutFile git.zip; `
Expand-Archive git.zip -DestinationPath C:\git;
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

FROM mcr.microsoft.com/powershell:nanoserver-1903
COPY --from=git /git /git
RUN $major, $minor, $patch, $build = $env:GIT_VERSION.split('.'); `
if ($build -ne '1') { `
$exePath = ('MinGit-{0}.{1}.{2}.{3}-busybox-64-bit.zip' -f $major, $minor, $patch, $build); `
} `
else { `
$exePath = ('MinGit-{0}.{1}.{2}-busybox-64-bit.zip' -f $major, $minor, $patch); `
} `
$url = ('https://github.com/git-for-windows/git/releases/download/v{0}.{1}.{2}.windows.{3}/{4}' -f $major, $minor, $patch, $build, $exePath); `
Invoke-WebRequest -UseBasicParsing $url -OutFile git.zip; `
Expand-Archive git.zip -DestinationPath C:\git; `
Remove-Item git.zip; `
git --version;

ADD windows/* /bin/

# https://github.com/PowerShell/PowerShell/issues/6211#issuecomment-367477137
USER ContainerAdministrator
RUN setx /M PATH "%PATH%;C:\Program Files\PowerShell"

SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
CMD [ "pwsh", "C:\\bin\\clone.ps1" ]
6 changes: 0 additions & 6 deletions docker/manifest.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ manifests:
variant: v6
architecture: arm
os: linux
-
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
platform:
architecture: amd64
os: windows
version: 1803
-
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
platform:
Expand Down
4 changes: 0 additions & 4 deletions windows/clone.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
$ErrorActionPreference = 'Stop';

# HACK: no clue how to set the PATH inside the Dockerfile,
# so am setting it here instead. This is not idea.
$Env:PATH += ';C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin'

# if the workspace is set we should make sure
# it is the current working directory.

Expand Down