github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/images/bootstrap/Dockerfile (about) 1 # Copyright 2017 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 basic workspace setup, with gcloud and a bootstrap runner 16 17 FROM debian:stretch 18 LABEL maintainer="Sen Lu <senlu@google.com>" 19 20 WORKDIR /workspace 21 RUN mkdir -p /workspace 22 ENV WORKSPACE=/workspace \ 23 TERM=xterm 24 25 # add env we can debug with the image name:tag 26 ARG IMAGE_ARG 27 ENV IMAGE=${IMAGE_ARG} 28 29 # common util tools 30 # https://github.com/GoogleCloudPlatform/gsutil/issues/446 for python-openssl 31 RUN apt-get update && apt-get install -y --no-install-recommends \ 32 build-essential \ 33 ca-certificates \ 34 curl \ 35 file \ 36 git \ 37 jq \ 38 mercurial \ 39 openssh-client \ 40 pkg-config \ 41 procps \ 42 python \ 43 python-dev \ 44 python-openssl \ 45 python-pip \ 46 rsync \ 47 unzip \ 48 wget \ 49 xz-utils \ 50 zip \ 51 zlib1g-dev \ 52 && apt-get clean \ 53 && python -m pip install --upgrade pip setuptools wheel 54 55 # Install gcloud 56 57 ENV PATH=/google-cloud-sdk/bin:/workspace:${PATH} \ 58 CLOUDSDK_CORE_DISABLE_PROMPTS=1 59 60 RUN wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz && \ 61 tar xzf google-cloud-sdk.tar.gz -C / && \ 62 rm google-cloud-sdk.tar.gz && \ 63 /google-cloud-sdk/install.sh \ 64 --disable-installation-options \ 65 --bash-completion=false \ 66 --path-update=false \ 67 --usage-reporting=false && \ 68 gcloud components install alpha beta kubectl && \ 69 gcloud info | tee /workspace/gcloud-info.txt 70 71 72 # 73 # BEGIN: DOCKER IN DOCKER SETUP 74 # 75 76 # Install Docker deps, some of these are already installed in the image but 77 # that's fine since they won't re-install and we can reuse the code below 78 # for another image someday. 79 RUN apt-get update && apt-get install -y --no-install-recommends \ 80 apt-transport-https \ 81 ca-certificates \ 82 curl \ 83 gnupg2 \ 84 software-properties-common \ 85 lsb-release 86 87 # Add the Docker apt-repository 88 RUN curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg \ 89 | apt-key add - && \ 90 add-apt-repository \ 91 "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ 92 $(lsb_release -cs) stable" 93 94 # Install Docker 95 # TODO(bentheelder): the `sed` is a bit of a hack, look into alternatives. 96 # Why this exists: `docker service start` on debian runs a `cgroupfs_mount` method, 97 # We're already inside docker though so we can be sure these are already mounted. 98 # Trying to remount these makes for a very noisy error block in the beginning of 99 # the pod logs, so we just comment out the call to it... :shrug: 100 # TODO(benthelder): update docker version. This is pinned because of 101 # https://github.com/kubernetes/test-infra/issues/6187 102 RUN apt-get update && \ 103 apt-get install -y --no-install-recommends docker-ce=18.06.0* && \ 104 sed -i 's/cgroupfs_mount$/#cgroupfs_mount\n/' /etc/init.d/docker 105 106 107 # Move Docker's storage location 108 RUN echo 'DOCKER_OPTS="${DOCKER_OPTS} --data-root=/docker-graph"' | \ 109 tee --append /etc/default/docker 110 # NOTE this should be mounted and persisted as a volume ideally (!) 111 # We will make a fallback one now just in case 112 RUN mkdir /docker-graph 113 114 # add custom docker cleanup binary 115 COPY ["barnacle/barnacle", "/usr/local/bin/"] 116 117 # 118 # END: DOCKER IN DOCKER SETUP 119 # 120 121 122 # note the runner is also responsible for making docker in docker function if 123 # env DOCKER_IN_DOCKER_ENABLED is set and similarly responsible for generating 124 # .bazelrc files if bazel remote caching is enabled 125 COPY ["entrypoint.sh", "runner.sh", "create_bazel_cache_rcs.sh", \ 126 "/usr/local/bin/"] 127 128 # TODO(krzyzacy): Move the scenario scripts to kubekins v2 129 # The bundled scenarios are for podutil jobs, bootstrap jobs will still use 130 # scenario scripts from cloned test-infra 131 RUN mkdir /workspace/scenarios 132 COPY ["./scenarios", "/workspace/scenarios"] 133 134 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]