Commit b92bfbaa authored by Steve Azzopardi's avatar Steve Azzopardi

Add windows Dockerfiles for gitlab-runner-helper

Add the initial Dockerfiles for windows server, using servercore as the
bilder image, which gives us access to powershell, and nanoserver as the
final image to keep the image as small as possible.

These Dockerfiles expect to have
`./binaries/gitlab-runner-helper.win_amd64.exe` built already, it will
NOT build the binary itself to stay consistent with the Linux
Dockerfiles and reduce duplication.

We need to add a Dockerfile for each windows server version that we want
to support, because when you run windows containers the host machine and
the container version has to match. For example of your machine that
has docker installed in running `ltsc2019` the containers it can run are
only of the version `ltsc2019`
parent 795520f0
Pipeline #49815056 passed with stages
in 30 minutes and 48 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_LFS_VERSION
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 Expand-Archive -Path git.zip -DestinationPath git
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
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_LFS_VERSION
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 Expand-Archive -Path git.zip -DestinationPath git
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
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"]
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