forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.windows
66 lines (54 loc) · 3.22 KB
/
Dockerfile.windows
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
63
64
65
66
####################################################################################################
# Builder image
# Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
# Also used as the image in CI jobs so needs all dependencies
####################################################################################################
ARG IMAGE_OS_VERSION=1809
# had issues with official golange image for windows so I'm using plain servercore
FROM mcr.microsoft.com/windows/servercore:${IMAGE_OS_VERSION} as builder
ENV GOLANG_VERSION=1.17
SHELL ["powershell", "-Command"]
# install chocolatey package manager
ENV chocolateyUseWindowsCompression=false
RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); \
choco feature disable --name showDownloadProgress ; \
choco feature enable -n allowGlobalConfirmation
# install golang, dep and other tools
RUN choco install golang --version=$env:GOLANG_VERSION ; \
choco install make dep docker-cli git.portable 7zip.portable
####################################################################################################
# argoexec-base
# Used as the base for both the release and development version of argoexec
####################################################################################################
FROM mcr.microsoft.com/windows/nanoserver:${IMAGE_OS_VERSION} as argoexec-base
COPY --from=builder /windows/system32/netapi32.dll /windows/system32/netapi32.dll
# NOTE: kubectl version should be one minor version less than https://storage.googleapis.com/kubernetes-release/release/stable.txt
ENV KUBECTL_VERSION=1.19.6
ENV JQ_VERSION=1.6
RUN mkdir C:\app && \
curl -L -o C:\app\kubectl.exe "https://storage.googleapis.com/kubernetes-release/release/v%KUBECTL_VERSION%/bin/windows/amd64/kubectl.exe" && \
curl -L -o C:\app\jq.exe "https://github.com/stedolan/jq/releases/download/jq-%JQ_VERSION%/jq-win64.exe"
COPY --from=builder C:/ProgramData/chocolatey/lib/docker-cli/tools/docker.exe C:/app/docker.exe
COPY --from=builder C:/tools/git C:/app/git
COPY --from=builder C:/ProgramData/chocolatey/lib/7zip.portable/tools/7z-extra/x64/7za.exe C:/app/7za.exe
# add binaries to path
USER Administrator
RUN SETX /m path C:\app;C:\app\git\bin;%path%
####################################################################################################
# Argo Build stage which performs the actual build of Argo binaries
####################################################################################################
FROM builder as argo-build
# Perform the build
WORKDIR C:/Users/ContainerAdministrator/go/src/github.com/argoproj/argo-workflows
COPY . .
# check we can use Git
RUN git rev-parse HEAD
# run in git bash for all the shell commands in Makefile to work
RUN bash -c 'make dist/argoexec'
####################################################################################################
# argoexec
####################################################################################################
FROM argoexec-base as argoexec
COPY --from=argo-build C:/Users/ContainerAdministrator/go/src/github.com/argoproj/argo-workflows/dist/argoexec C:/app/argoexec.exe
RUN argoexec version
ENTRYPOINT [ "argoexec" ]