|
| 1 | +# Copyright 2021 The Kubernetes Authors All rights reserved. |
| 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 kubernetes/minikube CI |
| 16 | +# NOTE: we attempt to avoid unnecessary tools and image layers while |
| 17 | +# supporting kubernetes builds, minikube installation, etc. |
| 18 | +FROM debian:buster |
| 19 | + |
| 20 | +# arg that specifies the go version to install |
| 21 | +ARG GO_VERSION |
| 22 | + |
| 23 | +# add envs: |
| 24 | +# - hinting that we are in a docker container |
| 25 | +ENV GOPATH=/home/prow/go \ |
| 26 | + PATH=/usr/local/go/bin:${PATH} \ |
| 27 | + CONTAINER=docker |
| 28 | + |
| 29 | + |
| 30 | +# Install tools needed to: |
| 31 | +# - install docker |
| 32 | +# |
| 33 | +# TODO: the `sed` is a bit of a hack, look into alternatives. |
| 34 | +# Why this exists: `docker service start` on debian runs a `cgroupfs_mount` method, |
| 35 | +# We're already inside docker though so we can be sure these are already mounted. |
| 36 | +# Trying to remount these makes for a very noisy error block in the beginning of |
| 37 | +# the pod logs, so we just comment out the call to it... :shrug: |
| 38 | +RUN echo "Installing Packages ..." \ |
| 39 | + && apt-get update \ |
| 40 | + && apt-get install -y --no-install-recommends \ |
| 41 | + apt-transport-https \ |
| 42 | + build-essential \ |
| 43 | + ca-certificates \ |
| 44 | + curl \ |
| 45 | + file \ |
| 46 | + git \ |
| 47 | + gnupg2 \ |
| 48 | + kmod \ |
| 49 | + lsb-release \ |
| 50 | + mercurial \ |
| 51 | + pkg-config \ |
| 52 | + procps \ |
| 53 | + python \ |
| 54 | + python-dev \ |
| 55 | + python-pip \ |
| 56 | + rsync \ |
| 57 | + software-properties-common \ |
| 58 | + unzip \ |
| 59 | + && rm -rf /var/lib/apt/lists/* \ |
| 60 | + && echo "Installing Go ..." \ |
| 61 | + && export GO_TARBALL="go${GO_VERSION}.linux-amd64.tar.gz"\ |
| 62 | + && curl -fsSL "https://storage.googleapis.com/golang/${GO_TARBALL}" --output "${GO_TARBALL}" \ |
| 63 | + && tar xzf "${GO_TARBALL}" -C /usr/local \ |
| 64 | + && rm "${GO_TARBALL}"\ |
| 65 | + && mkdir -p "${GOPATH}/bin" \ |
| 66 | + && echo "Installing Docker ..." \ |
| 67 | + && curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - \ |
| 68 | + && add-apt-repository \ |
| 69 | + "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ |
| 70 | + $(lsb_release -cs) stable" \ |
| 71 | + && apt-get update \ |
| 72 | + && apt-get install -y --no-install-recommends docker-ce \ |
| 73 | + && rm -rf /var/lib/apt/lists/* \ |
| 74 | + && sed -i 's/cgroupfs_mount$/#cgroupfs_mount\n/' /etc/init.d/docker \ |
| 75 | + && echo "Ensuring Legacy Iptables ..." \ |
| 76 | + && update-alternatives --set iptables /usr/sbin/iptables-legacy \ |
| 77 | + && update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy \ |
| 78 | + && echo "Installing Kubectl ..." \ |
| 79 | + && curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" \ |
| 80 | + && chmod +x ./kubectl \ |
| 81 | + && cp kubectl /usr/local/bin |
| 82 | +# copy in image utility scripts |
| 83 | +COPY wrapper.sh /usr/local/bin/ |
| 84 | +# entrypoint is our wrapper script, in Prow you will need to explicitly re-specify this |
| 85 | +ENTRYPOINT ["wrapper.sh", "/bin/bash"] |
| 86 | +# volume for docker in docker, use an emptyDir in Prow |
| 87 | +VOLUME ["/var/lib/docker"] |
0 commit comments