UNCLASSIFIED

Dockerfile.windows 4.81 KB
Newer Older
1
FROM alpine:3.12 AS build
2

3 4 5 6 7
RUN apk --no-cache add \
    curl \
    unzip

# Dapper/Drone/CI environment
8
FROM rancher/hardened-build-base:v1.16.6b7 AS dapper
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
ENV DAPPER_ENV GODEBUG REPO TAG DRONE_TAG PAT_USERNAME PAT_TOKEN KUBERNETES_VERSION DOCKER_BUILDKIT DRONE_BUILD_EVENT IMAGE_NAME GCLOUD_AUTH ENABLE_REGISTRY
ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH
ENV DAPPER_OUTPUT ./dist ./bin ./build
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_TARGET dapper
ENV DAPPER_RUN_ARGS "--privileged --network host -v /tmp:/tmp -v rke2-pkg:/go/pkg -v rke2-cache:/root/.cache/go-build"
RUN apk update
RUN set -x \
    && apk add --no-cache \
    mingw-w64-gcc \
    libarchive-tools \
    gcc \
    bsd-compat-headers \
    zstd \
    jq \
    python2 \
    git \
    libseccomp-dev \
    rsync \
    file \
    bash \
    py-pip
RUN curl -sL https://storage.googleapis.com/kubernetes-release/release/$( \
    curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt \
    )/bin/linux/${ARCH}/kubectl -o /usr/local/bin/kubectl && \
    chmod a+x /usr/local/bin/kubectl; \
    pip install codespell
37
RUN curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.41.0
38 39 40 41
WORKDIR /source
# End Dapper stuff

FROM build as windows-runtime-collect
42 43
ARG KUBERNETES_VERSION=dev

44
# windows runtime image
45
ENV CRICTL_VERSION="v1.21.0"
46
ENV CONTAINERD_VERSION="1.5.4"
47 48
ENV WINS_VERSION="0.1.1"
ENV FLANNEL_VERSION="v0.14.0"
49
ENV CALICO_VERSION="v3.19.2"
50 51 52
ENV CNI_PLUGIN_VERSION="v0.9.1"

RUN mkdir -p rancher
53 54
RUN curl -sLO https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-windows-amd64.tar.gz
RUN curl -sLO https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-windows-amd64.tar.gz.sha256sum
55 56
RUN sha256sum -c containerd-${CONTAINERD_VERSION}-windows-amd64.tar.gz.sha256sum

57 58 59
RUN curl -sLO https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-windows-amd64.tar.gz
RUN curl -SLO https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-windows-amd64.tar.gz.sha256
RUN sha256sum -c ./crictl-${CRICTL_VERSION}-windows-amd64.tar.gz.sha256
60

61 62
RUN curl -sLO https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGIN_VERSION}/cni-plugins-windows-amd64-${CNI_PLUGIN_VERSION}.tgz
RUN curl -sLO https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGIN_VERSION}/cni-plugins-windows-amd64-${CNI_PLUGIN_VERSION}.tgz.sha256
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
RUN sha256sum -c cni-plugins-windows-amd64-${CNI_PLUGIN_VERSION}.tgz.sha256

RUN curl -sLO https://github.com/rancher/wins/releases/download/v${WINS_VERSION}/wins.exe
RUN curl -sLO https://github.com/rancher/wins/releases/download/v${WINS_VERSION}/sha256sum.txt
RUN cat sha256sum.txt | head -n1 | awk '{print $1"  wins.exe"}' >> wins.exe.sha256
RUN sha256sum -c wins.exe.sha256
RUN mv wins.exe rancher/

RUN curl -sLO https://dl.k8s.io/release/${KUBERNETES_VERSION}/bin/windows/amd64/kubectl.exe
RUN curl -sLO https://dl.k8s.io/${KUBERNETES_VERSION}/bin/windows/amd64/kubectl.exe.sha256
RUN echo "  kubectl.exe" >> kubectl.exe.sha256
RUN sha256sum -c kubectl.exe.sha256
RUN mv kubectl.exe rancher/

RUN curl -sLO https://dl.k8s.io/release/${KUBERNETES_VERSION}/bin/windows/amd64/kubelet.exe
RUN curl -sLO https://dl.k8s.io/${KUBERNETES_VERSION}/bin/windows/amd64/kubelet.exe.sha256
RUN echo "  kubelet.exe" >> kubelet.exe.sha256
RUN sha256sum -c kubelet.exe.sha256
RUN mv kubelet.exe rancher/

RUN curl -sLO https://dl.k8s.io/release/${KUBERNETES_VERSION}/bin/windows/amd64/kube-proxy.exe
RUN curl -sLO https://dl.k8s.io/${KUBERNETES_VERSION}/bin/windows/amd64/kube-proxy.exe.sha256
RUN echo "  kube-proxy.exe" >> kube-proxy.exe.sha256
RUN sha256sum -c kube-proxy.exe.sha256
RUN mv kube-proxy.exe rancher/

RUN curl -sLO https://github.com/flannel-io/flannel/releases/download/${FLANNEL_VERSION}/flannel-${FLANNEL_VERSION}-windows-amd64.tar.gz
RUN curl -sLO https://github.com/projectcalico/calico/releases/download/${CALICO_VERSION}/calico-windows-${CALICO_VERSION}.zip
RUN curl -sL https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/hns.psm1 -o rancher/hns.psm1

93
RUN tar xzvf crictl-${CRICTL_VERSION}-windows-amd64.tar.gz crictl.exe -C rancher/
94
RUN tar xvzf containerd-${CONTAINERD_VERSION}-windows-amd64.tar.gz -C rancher/
95
RUN tar xzvf cni-plugins-windows-amd64-${CNI_PLUGIN_VERSION}.tgz ./flannel.exe ./win-overlay.exe ./host-local.exe -C rancher/
96 97 98 99 100 101 102
RUN tar xzvf flannel-${FLANNEL_VERSION}-windows-amd64.tar.gz flanneld.exe -C rancher/

RUN unzip calico-windows-${CALICO_VERSION}.zip
RUN mv CalicoWindows/calico-node.exe rancher/
RUN mv CalicoWindows/cni/calico.exe rancher/
RUN mv CalicoWindows/cni/calico-ipam.exe rancher/

103 104
FROM scratch AS windows-runtime
COPY --from=windows-runtime-collect ./rancher/* /bin/