Commit 9368cf24 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Merge branch '3755-helper-image-for-windows-container-execution-dockerfiles' into 'master'

Add windows Dockerfiles for gitlab-runner-helper

See merge request gitlab-org/gitlab-runner!1167
parents bc604945 26a8bee5
Pipeline #50116496 failed with stages
in 7 minutes and 27 seconds
# escape=`
FROM mcr.microsoft.com/windows/servercore:1803 as builder
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG GIT_VERSION
ARG GIT_VERSION_BUILD
ARG GIT_256_CHECKSUM
ARG GIT_LFS_VERSION
ARG GIT_LFS_256_CHECKSUM
RUN Invoke-Webrequest "https://github.com/git-for-windows/git/releases/download/v${Env:GIT_VERSION}.windows.${Env:GIT_VERSION_BUILD}/MinGit-${Env:GIT_VERSION}-64-bit.zip" -OutFile git.zip -UseBasicParsing
RUN Invoke-Webrequest "https://github.com/git-lfs/git-lfs/releases/download/v${Env:GIT_LFS_VERSION}/git-lfs-windows-amd64-v${Env:GIT_LFS_VERSION}.zip" -OutFile git-lfs.zip -UseBasicParsing
COPY [".\\helpers\\checksum.ps1", ".\\"]
RUN powershell -File .\checksum.ps1 -TargetFile git.zip -ExpectedHash ${Env:GIT_256_CHECKSUM}
RUN powershell -File .\checksum.ps1 -TargetFile git-lfs.zip -ExpectedHash ${Env:GIT_LFS_256_CHECKSUM}
RUN Expand-Archive -Path git.zip -DestinationPath git
RUN Expand-Archive -Path git-lfs.zip -DestinationPath git-lfs
FROM mcr.microsoft.com/windows/nanoserver:1803
USER ContainerAdministrator
# https://github.com/StefanScherer/dockerfiles-windows/tree/master/golang-issue-21867
COPY --from=builder ["/windows/system32/netapi32.dll", "/windows/system32/netapi32.dll"]
COPY --from=builder ["git", "C:\\Program Files\\git"]
COPY --from=builder ["git-lfs", "C:\\Program Files\\git-lfs"]
RUN setx PATH "%PATH%;C:\Program Files\git\cmd;C:\Program Files\git-lfs;C:\Program Files\gitlab-runner-helper" /M
RUN git lfs install --skip-repo
COPY [".\\binaries\\gitlab-runner-helper.x86_64-windows.exe", "C:\\Program Files\\gitlab-runner-helper\\gitlab-runner-helper.exe"]
# escape=`
FROM mcr.microsoft.com/windows/servercore:1809_amd64 as builder
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG GIT_VERSION
ARG GIT_VERSION_BUILD
ARG GIT_256_CHECKSUM
ARG GIT_LFS_VERSION
ARG GIT_LFS_256_CHECKSUM
RUN Invoke-Webrequest "https://github.com/git-for-windows/git/releases/download/v${Env:GIT_VERSION}.windows.${Env:GIT_VERSION_BUILD}/MinGit-${Env:GIT_VERSION}-64-bit.zip" -OutFile git.zip -UseBasicParsing
RUN Invoke-Webrequest "https://github.com/git-lfs/git-lfs/releases/download/v${Env:GIT_LFS_VERSION}/git-lfs-windows-amd64-v${Env:GIT_LFS_VERSION}.zip" -OutFile git-lfs.zip -UseBasicParsing
COPY [".\\helpers\\checksum.ps1", ".\\"]
RUN powershell -File .\checksum.ps1 -TargetFile git.zip -ExpectedHash ${Env:GIT_256_CHECKSUM}
RUN powershell -File .\checksum.ps1 -TargetFile git-lfs.zip -ExpectedHash ${Env:GIT_LFS_256_CHECKSUM}
RUN Expand-Archive -Path git.zip -DestinationPath git
RUN Expand-Archive -Path git-lfs.zip -DestinationPath git-lfs
FROM mcr.microsoft.com/windows/nanoserver:1809_amd64
USER ContainerAdministrator
# https://github.com/StefanScherer/dockerfiles-windows/tree/master/golang-issue-21867
COPY --from=builder ["/windows/system32/netapi32.dll", "/windows/system32/netapi32.dll"]
COPY --from=builder ["git", "C:\\Program Files\\git"]
COPY --from=builder ["git-lfs", "C:\\Program Files\\git-lfs"]
RUN setx PATH "%PATH%;C:\Program Files\git\cmd;C:\Program Files\git-lfs;C:\Program Files\gitlab-runner-helper" /M
RUN git lfs install --skip-repo
COPY [".\\binaries\\gitlab-runner-helper.x86_64-windows.exe", "C:\\Program Files\\gitlab-runner-helper\\gitlab-runner-helper.exe"]
param(
[string]$TargetFile,
[string]$ExpectedHash
)
$hash = Get-FileHash -Path $TargetFile -Algorithm SHA256
if (-not ($hash.Hash -eq $ExpectedHash)) {
Write-Warning "SHA256 checksum for $TargetFile is invalid"
exit 1
}
Write-Output "SHA256 checksum for $TargetFile is valid"
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment