144 lines
6.9 KiB
Docker
144 lines
6.9 KiB
Docker
FROM registry.suse.com/bci/golang:1.22
|
|
|
|
ARG DAPPER_HOST_ARCH
|
|
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
|
|
ENV CATTLE_HELM_VERSION v2.16.8-rancher2
|
|
ENV CATTLE_MACHINE_VERSION v0.15.0-rancher116
|
|
ENV CATTLE_K3S_VERSION v1.30.2+k3s2
|
|
# helm 3 version
|
|
ENV HELM_VERSION v3.15.2
|
|
ENV KUSTOMIZE_VERSION v5.4.2
|
|
ENV HELM_UNITTEST_VERSION 0.3.2
|
|
# k3d ci version
|
|
ENV K3D_VERSION v5.7.1
|
|
|
|
# kontainer-driver-metadata branch to be set for specific branch other than dev/master, logic at rancher/rancher/pkg/settings/setting.go
|
|
ENV CATTLE_KDM_BRANCH=release-v2.9
|
|
|
|
RUN zypper -n install gcc binutils glibc-devel-static ca-certificates git-core wget curl unzip tar vim less file xz gzip sed gawk iproute2 iptables jq skopeo
|
|
# use containerd from k3s image, not from bci
|
|
RUN zypper install -y -f docker && rpm -e --nodeps --noscripts containerd
|
|
|
|
# prevents `detected dubious ownership in repository` git error due to uid/gid not matching when using bind mounts
|
|
RUN git config -f /etc/gitconfig --add safe.directory /go/src/github.com/rancher/rancher
|
|
|
|
RUN curl -sLf https://github.com/rancher/machine/releases/download/${CATTLE_MACHINE_VERSION}/rancher-machine-${ARCH}.tar.gz | tar xvzf - -C /usr/bin
|
|
RUN if [ "${ARCH}" != "s390x" ]; then \
|
|
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${K3D_VERSION} bash; \
|
|
fi
|
|
|
|
ENV GOLANGCI_LINT v1.59.0
|
|
RUN if [ "${ARCH}" == "amd64" ]; then \
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "${GOLANGCI_LINT}"; \
|
|
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/spectrometer/master/install.sh | sh; \
|
|
fi
|
|
|
|
# Tool for CRD generation.
|
|
ENV CONTROLLER_GEN_VERSION v0.14.0
|
|
RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}
|
|
|
|
# YAML processor for release configuration.
|
|
ENV YQ_VERSION v4.44.2
|
|
RUN wget -q https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${ARCH}.tar.gz -O - | tar xz && mv yq_linux_${ARCH} /usr/bin/yq
|
|
|
|
ENV HELM_URL_V2_amd64=https://github.com/rancher/helm/releases/download/${CATTLE_HELM_VERSION}/rancher-helm \
|
|
HELM_URL_V2_arm64=https://github.com/rancher/helm/releases/download/${CATTLE_HELM_VERSION}/rancher-helm-arm64 \
|
|
HELM_URL_V2_s390x=https://github.com/rancher/helm/releases/download/${CATTLE_HELM_VERSION}/rancher-helm-s390x \
|
|
HELM_URL_V2=HELM_URL_V2_${ARCH} \
|
|
HELM_URL_V3=https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz \
|
|
TILLER_URL_amd64=https://github.com/rancher/helm/releases/download/${CATTLE_HELM_VERSION}/rancher-tiller \
|
|
TILLER_URL_arm64=https://github.com/rancher/helm/releases/download/${CATTLE_HELM_VERSION}/rancher-tiller-arm64 \
|
|
TILLER_URL_s390x=https://github.com/rancher/helm/releases/download/${CATTLE_HELM_VERSION}/rancher-tiller-s390x \
|
|
TILLER_URL=TILLER_URL_${ARCH} \
|
|
KUSTOMIZE_URL=https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_${ARCH}.tar.gz
|
|
|
|
RUN curl -sLf ${KUSTOMIZE_URL} | tar -xzf - -C /usr/bin
|
|
|
|
# set up helm 2
|
|
RUN curl -sLf ${!HELM_URL_V2} -o /usr/bin/rancher-helm && \
|
|
curl -sLf ${!TILLER_URL} -o /usr/bin/rancher-tiller && \
|
|
chmod +x /usr/bin/rancher-helm /usr/bin/rancher-tiller && \
|
|
ln -s /usr/bin/rancher-helm /usr/bin/helm && \
|
|
ln -s /usr/bin/rancher-tiller /usr/bin/tiller && \
|
|
helm init -c --stable-repo-url https://charts.helm.sh/stable/
|
|
|
|
# set up helm 3
|
|
RUN mkdir /usr/tmp && \
|
|
curl ${HELM_URL_V3} | tar xvzf - --strip-components=1 -C /usr/tmp/ && \
|
|
mv /usr/tmp/helm /usr/bin/helm_v3 && \
|
|
chmod +x /usr/bin/kustomize
|
|
|
|
# Set up K3s: copy the necessary binaries from the K3s image.
|
|
COPY --from=rancher/k3s:v1.30.2-k3s2 \
|
|
/bin/blkid \
|
|
/bin/bandwidth \
|
|
/bin/cni \
|
|
/bin/conntrack \
|
|
/bin/containerd \
|
|
/bin/containerd-shim-runc-v2 \
|
|
/bin/ethtool \
|
|
/bin/firewall \
|
|
/bin/ip \
|
|
/bin/ipset \
|
|
/bin/k3s \
|
|
/bin/losetup \
|
|
/bin/pigz \
|
|
/bin/runc \
|
|
/bin/which \
|
|
/bin/aux/xtables-legacy-multi \
|
|
/usr/bin/
|
|
|
|
RUN mkdir -p /go/src/github.com/rancher/rancher/.kube
|
|
|
|
RUN ln -s /usr/bin/cni /usr/bin/bridge && \
|
|
ln -s /usr/bin/cni /usr/bin/flannel && \
|
|
ln -s /usr/bin/cni /usr/bin/host-local && \
|
|
ln -s /usr/bin/cni /usr/bin/loopback && \
|
|
ln -s /usr/bin/cni /usr/bin/portmap && \
|
|
ln -s /usr/bin/k3s /usr/bin/crictl && \
|
|
ln -s /usr/bin/k3s /usr/bin/ctr && \
|
|
ln -s /usr/bin/k3s /usr/bin/k3s-agent && \
|
|
ln -s /usr/bin/k3s /usr/bin/k3s-etcd-snapshot && \
|
|
ln -s /usr/bin/k3s /usr/bin/k3s-server && \
|
|
ln -s /usr/bin/k3s /usr/bin/kubectl && \
|
|
ln -s /usr/bin/pigz /usr/bin/unpigz && \
|
|
ln -s /usr/bin/xtables-legacy-multi /usr/bin/iptables && \
|
|
ln -s /usr/bin/xtables-legacy-multi /usr/bin/iptables-save && \
|
|
ln -s /usr/bin/xtables-legacy-multi /usr/bin/iptables-restore && \
|
|
ln -s /usr/bin/xtables-legacy-multi /usr/bin/iptables-translate && \
|
|
ln -s /usr/bin/xtables-legacy-multi /usr/bin/ip6tables && \
|
|
ln -s /usr/bin/xtables-legacy-multi /usr/bin/ip6tables-save && \
|
|
ln -s /usr/bin/xtables-legacy-multi /usr/bin/ip6tables-restore && \
|
|
ln -s /usr/bin/xtables-legacy-multi /usr/bin/ip6tables-translate && \
|
|
ln -s /etc/rancher/k3s/k3s.yaml /go/src/github.com/rancher/rancher/.kube/k3s.yaml
|
|
|
|
|
|
RUN curl -sLf https://github.com/rancher/k3s/releases/download/${CATTLE_K3S_VERSION}/k3s-images.txt -o /usr/tmp/k3s-images.txt
|
|
|
|
# Python related dependencies for the Integration/Validation tests.
|
|
RUN zypper -n install python311-pip python311-base python311 python311-devel python311-tox libffi-devel libopenssl-devel
|
|
|
|
ENV HELM_HOME /root/.helm
|
|
ENV DAPPER_ENV REPO TAG CI DRONE_BUILD_NUMBER DRONE_TAG DRONE_COMMIT DRONE_BRANCH DRONE_BUILD_EVENT SYSTEM_CHART_DEFAULT_BRANCH FOSSA_API_KEY GOGET_MODULE GOGET_VERSION RELEASE_ACTION RELEASE_TYPE POSTRELEASE_RANCHER_VERSION POSTRELEASE_RANCHER_STABLE DEBUG SOME_K8S_VERSION V2PROV_TEST_DIST V2PROV_TEST_RUN_REGEX V2PROV_DISTRO_DATA_DIR V2PROV_PROVISIONING_DATA_DIR V2PROV_SYSTEM_AGENT_DATA_DIR
|
|
ENV DAPPER_SOURCE /go/src/github.com/rancher/rancher/
|
|
ENV DAPPER_OUTPUT ./bin ./dist ./go.mod ./go.sum ./pkg/apis/go.mod ./pkg/apis/go.sum ./pkg/client/go.mod ./pkg/client/go.sum ./scripts/package ./pkg/settings/setting.go ./package/Dockerfile ./Dockerfile.dapper ./pkg/crds/yaml/generated
|
|
ENV DAPPER_DOCKER_SOCKET true
|
|
ARG CI
|
|
ARG DRONE_BUILD_NUMBER
|
|
ENV DAPPER_RUN_ARGS "-v rancher2-go16-pkg-1:/go/pkg -v rancher2-go16-cache-1:/root/.cache/go-build --privileged --label CI=${CI} --label DRONE_BUILD_NUMBER=${DRONE_BUILD_NUMBER}"
|
|
ENV GOCACHE /root/.cache/go-build
|
|
ENV HOME ${DAPPER_SOURCE}
|
|
|
|
# set up helm unittest - only needs to run on one arch. Needs to run after $HOME has been changed so we can find it later
|
|
RUN if [ "${ARCH}" == "amd64" ]; then \
|
|
helm_v3 plugin install https://github.com/helm-unittest/helm-unittest.git --version ${HELM_UNITTEST_VERSION}; \
|
|
fi
|
|
|
|
|
|
VOLUME /var/lib/rancher
|
|
VOLUME /var/lib/kubelet
|
|
WORKDIR ${DAPPER_SOURCE}
|
|
|
|
ENTRYPOINT ["./scripts/entry"]
|
|
CMD ["ci"]
|