working windows images [ci skip]

This commit is contained in:
Brad Rydzewski 2018-09-11 16:06:41 -07:00
parent 471219f57f
commit 7fcace7751
3 changed files with 20 additions and 30 deletions

View File

@ -1,21 +1,14 @@
FROM microsoft/windowsservercore:1709 AS git FROM microsoft/windowsservercore:1709 AS git
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV GIT_VERSION 2.14.1
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/v${GIT_VERSION}.windows.1/MinGit-${GIT_VERSION}-64-bit.zip
ENV GIT_SHA256 65c12e4959b8874187b68ec37e532fe7fc526e10f6f0f29e699fa1d2449e7d92
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
Invoke-WebRequest -UseBasicParsing $env:GIT_DOWNLOAD_URL -OutFile git.zip; \ Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.19.0-rc2.windows.1/MinGit-2.19.0.rc2.windows.1-64-bit.zip -OutFile git.zip; \
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_SHA256) {exit 1} ; \ Expand-Archive git.zip -DestinationPath C:\git
Expand-Archive git.zip -DestinationPath C:\git; \
Remove-Item git.zip
FROM microsoft/nanoserver:1709 FROM microsoft/windowsservercore:1709
USER ContainerAdministrator
COPY --from=git /git /git COPY --from=git /git /git
RUN setx /m PATH "%PATH%;C:\git\mingw64\bin;C:\git\usr\bin" ADD windows/* /bin/
ADD windows/* /
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENTRYPOINT [ "\\clone.ps1" ] CMD [ "powershell", "C:\\bin\\clone.ps1" ]

View File

@ -1,21 +1,14 @@
FROM microsoft/windowsservercore:1803 AS git FROM microsoft/windowsservercore:1803 AS git
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV GIT_VERSION 2.14.1
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/v${GIT_VERSION}.windows.1/MinGit-${GIT_VERSION}-64-bit.zip
ENV GIT_SHA256 65c12e4959b8874187b68ec37e532fe7fc526e10f6f0f29e699fa1d2449e7d92
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
Invoke-WebRequest -UseBasicParsing $env:GIT_DOWNLOAD_URL -OutFile git.zip; \ Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.19.0-rc2.windows.1/MinGit-2.19.0.rc2.windows.1-64-bit.zip -OutFile git.zip; \
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_SHA256) {exit 1} ; \ Expand-Archive git.zip -DestinationPath C:\git
Expand-Archive git.zip -DestinationPath C:\git; \
Remove-Item git.zip
FROM microsoft/nanoserver:1803 FROM microsoft/windowsservercore:1803
USER ContainerAdministrator
COPY --from=git /git /git COPY --from=git /git /git
RUN setx /m PATH "%PATH%;C:\git\mingw64\bin;C:\git\usr\bin" ADD windows/* /bin/
ADD windows/* /
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENTRYPOINT [ "\\clone.ps1" ] CMD [ "powershell", "C:\\bin\\clone.ps1" ]

View File

@ -1,5 +1,9 @@
$ErrorActionPreference = 'Stop'; $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 # if the workspace is set we should make sure
# it is the current working directory. # it is the current working directory.
@ -46,15 +50,15 @@ $Env:GIT_COMMITTER_EMAIL = $Env:GIT_AUTHOR_EMAIL
switch ($Env:DRONE_BUILD_EVENT) { switch ($Env:DRONE_BUILD_EVENT) {
"pull_request" { "pull_request" {
.\clone-pull-reqest.ps1 Invoke-Expression "${PSScriptRoot}\clone-pull-reqest.ps1"
break break
} }
"tag" { "tag" {
.\clone-tag.ps1 Invoke-Expression "${PSScriptRoot}\clone-tag.ps1"
break break
} }
default { default {
.\clone-commit.ps1 Invoke-Expression "${PSScriptRoot}\clone-commit.ps1"
break break
} }
} }