-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.nanoserver-1809
62 lines (52 loc) · 2.68 KB
/
Dockerfile.nanoserver-1809
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS builder
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN netsh interface ipv4 show subinterfaces; \
Get-NetAdapter | Where-Object Name -like "*Ethernet*" | ForEach-Object { \
& netsh interface ipv4 set subinterface $_.InterfaceIndex mtu=1410 store=persistent; \
}; \
netsh interface ipv4 show subinterfaces;
# install MinGit (especially for "go get")
# https://blogs.msdn.microsoft.com/visualstudioalm/2016/09/03/whats-new-in-git-for-windows-2-10/
# "Essentially, it is a Git for Windows that was stripped down as much as possible without sacrificing the functionality in which 3rd-party software may be interested."
# "It currently requires only ~45MB on disk."
ENV GIT_VERSION 2.30.2
ENV GIT_TAG v${GIT_VERSION}.windows.1
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/MinGit-${GIT_VERSION}-64-bit.zip
ENV GIT_DOWNLOAD_SHA256 168fdc5021f77ad51269a7fd778c9254a87418352bdc039723c078da693a3ac6
# steps inspired by "chcolateyInstall.ps1" from "git.install" (https://chocolatey.org/packages/git.install)
RUN Write-Host ('Downloading {0} to git.zip ...' -f $env:GIT_DOWNLOAD_URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip' -TimeoutSec 300; \
\
Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Expanding git.zip ...'; \
Expand-Archive -Path git.zip -DestinationPath C:\git\.; \
\
Write-Host 'Removing git.zip ...'; \
Remove-Item git.zip -Force; \
\
Write-Host 'Updating PATH ...'; \
$env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Write-Host 'Verifying install ("git version") ...'; \
git version; \
\
Write-Host 'Completed installing git.';
FROM mcr.microsoft.com/windows/nanoserver:1809
COPY --from=builder /git /git
COPY ./estafette-extension-git-clone.exe C:/estafette-extension-git-clone.exe
USER ContainerAdministrator
RUN setx /m PATH "%PATH%;C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin"
RUN git config --list --show-origin \
&& git config --global core.preloadindex true \
&& git config --global core.fscache true \
&& git config --global gc.auto 256
ENV ESTAFETTE_LOG_FORMAT="console"
ENTRYPOINT ["C:/estafette-extension-git-clone.exe"]