forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.runtime
More file actions
113 lines (99 loc) · 4.66 KB
/
Dockerfile.runtime
File metadata and controls
113 lines (99 loc) · 4.66 KB
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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Dockerfile.runtime — Rancher build and test environment
#
# This image is the container in which all "make <target>" commands run.
# It is built automatically by scripts/container-run the first time (or when
# this file changes), then reused from the local Docker image cache.
#
# You do not need to interact with this file directly. Use make:
#
# make build # compile rancher and agent binaries
# make test # run unit tests
# make package # build the rancher container image
# make ci # full CI build (default)
#
# The image is tagged with a content hash of this file, so any change here
# automatically triggers a rebuild on the next make invocation.
#
# Key contents:
# - Go toolchain (from registry.suse.com/bci/golang)
# - Docker CLI + buildx (for building container images inside the container)
# - K3s binaries (for integration tests that spin up a local cluster)
# - k3d (for provisioning tests)
# - golangci-lint (amd64 only)
# - rancher-machine
# - Python 3.11 + tox (for validation/integration test suites)
FROM registry.suse.com/bci/golang:1.25
ARG RUNTIME_HOST_ARCH
ENV HOST_ARCH=${RUNTIME_HOST_ARCH} ARCH=${RUNTIME_HOST_ARCH}
ENV CATTLE_MACHINE_VERSION=v0.15.0-rancher142
ENV CATTLE_K3S_VERSION=v1.35.3+k3s1
ENV HELM_UNITTEST_VERSION=1.0.3
# 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=dev-v2.15
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=v2.7.2
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "${GOLANGCI_LINT}"; \
fi
# Set up K3s: copy the necessary binaries from the K3s image.
COPY --from=rancher/k3s:v1.35.3-k3s1 \
/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 mkdir /usr/tmp && \
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 GOCACHE=/root/.cache/go-build
ENV HELM_HOME=/root/.helm
ENV HOME=/go/src/github.com/rancher/rancher
VOLUME /var/lib/rancher
VOLUME /var/lib/kubelet
WORKDIR /go/src/github.com/rancher/rancher
ENTRYPOINT ["scripts/entry"]