k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/images/krte/Dockerfile (about) 1 # Copyright 2019 The Kubernetes Authors. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # Includes tools used for sigs.k8s.io/kind CI 16 # NOTE: we attempt to avoid unnecessary tools and image layers while 17 # supporting kubernetes builds, kind installation, etc. 18 19 FROM debian:bookworm 20 21 # arg that specifies the image name (for debugging) 22 ARG IMAGE_ARG 23 24 # arg that specifies the go version to install. 25 # empty value specifies the latest version. 26 ARG GO_VERSION 27 28 # add envs: 29 # - so we can debug with the image name:tag 30 # - adding gsutil etc. to path (where we will install them) 31 # - disabling prompts when installing gsutil etc. 32 # - hinting that we are in a docker container 33 ENV KRTE_IMAGE=${IMAGE_ARG} \ 34 BAZEL_VERSION=${BAZEL_VERSION_ARG} \ 35 GOPATH=/home/prow/go \ 36 PATH=/home/prow/go/bin:/usr/local/go/bin:/google-cloud-sdk/bin:${PATH} \ 37 CLOUDSDK_CORE_DISABLE_PROMPTS=1 \ 38 CONTAINER=docker 39 40 # copy in image utility scripts 41 COPY wrapper.sh /usr/local/bin/ 42 43 # Install tools needed to: 44 # - install docker 45 # - build kind 46 # - build kubernetes 47 # 48 # TODO: the `sed` is a bit of a hack, look into alternatives. 49 # Why this exists: `docker service start` on debian runs a `cgroupfs_mount` method, 50 # We're already inside docker though so we can be sure these are already mounted. 51 # Trying to remount these makes for a very noisy error block in the beginning of 52 # the pod logs, so we just comment out the call to it... :shrug: 53 RUN echo "Installing Packages ..." \ 54 && apt-get update \ 55 && apt-get install -y --no-install-recommends \ 56 apt-transport-https \ 57 build-essential \ 58 ca-certificates \ 59 curl \ 60 file \ 61 git \ 62 gnupg2 \ 63 iproute2 \ 64 kmod \ 65 lsb-release \ 66 mercurial \ 67 pkg-config \ 68 procps \ 69 python3 \ 70 rsync \ 71 software-properties-common \ 72 unzip \ 73 && rm -rf /var/lib/apt/lists/* \ 74 && echo "Installing Go ..." \ 75 && if [ -z "${GO_VERSION}" ]; then GO_VERSION=$(curl -fsSL https://go.dev/VERSION?m=text | grep -oP "go\K(.*)"); fi \ 76 && export GO_TARBALL="go${GO_VERSION}.linux-amd64.tar.gz" \ 77 && curl -fsSL "https://go.dev/dl/${GO_TARBALL}" --output "${GO_TARBALL}" \ 78 && tar xzf "${GO_TARBALL}" -C /usr/local \ 79 && rm "${GO_TARBALL}"\ 80 && mkdir -p "${GOPATH}/bin" \ 81 && echo "Installing gcloud SDK, kubectl ..." \ 82 && curl -fsSL https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz --output google-cloud-sdk.tar.gz \ 83 && tar xzf google-cloud-sdk.tar.gz -C / \ 84 && rm google-cloud-sdk.tar.gz \ 85 && /google-cloud-sdk/install.sh \ 86 --disable-installation-options \ 87 --bash-completion=false \ 88 --path-update=false \ 89 --usage-reporting=false \ 90 && gcloud components install kubectl \ 91 && echo "Installing Docker ..." \ 92 && curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \ 93 && chmod a+r /etc/apt/keyrings/docker.gpg \ 94 && echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ 95 "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ 96 tee /etc/apt/sources.list.d/docker.list > /dev/null \ 97 && apt-get update \ 98 && apt-get install -y --no-install-recommends docker-ce docker-buildx-plugin \ 99 && rm -rf /var/lib/apt/lists/* \ 100 && sed -i 's/cgroupfs_mount$/#cgroupfs_mount\n/' /etc/init.d/docker \ 101 && sed -i 's/ulimit -Hn/# ulimit -Hn/g' /etc/init.d/docker \ 102 && echo "Ensuring Legacy Iptables ..." \ 103 && update-alternatives --set iptables /usr/sbin/iptables-legacy \ 104 && update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy 105 106 # entrypoint is our wrapper script, in Prow you will need to explicitly re-specify this 107 ENTRYPOINT ["wrapper.sh"] 108 # volume for docker in docker, use an emptyDir in Prow 109 VOLUME ["/var/lib/docker"]