github.com/abayer/test-infra@v0.0.5/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:jessie
    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      python \
    42      python-dev \
    43      python-openssl \
    44      python-pip \
    45      rsync \
    46      unzip \
    47      wget \
    48      xz-utils \
    49      zip \
    50      zlib1g-dev \
    51      && apt-get clean \
    52      && python -m pip install --upgrade pip setuptools wheel
    53  
    54  # Install gcloud
    55  
    56  ENV PATH=/google-cloud-sdk/bin:/workspace:${PATH} \
    57      CLOUDSDK_CORE_DISABLE_PROMPTS=1
    58  
    59  RUN wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz && \
    60      tar xzf google-cloud-sdk.tar.gz -C / && \
    61      rm google-cloud-sdk.tar.gz && \
    62      /google-cloud-sdk/install.sh \
    63          --disable-installation-options \
    64          --bash-completion=false \
    65          --path-update=false \
    66          --usage-reporting=false && \
    67      gcloud components install alpha beta kubectl && \
    68      gcloud info | tee /workspace/gcloud-info.txt
    69  
    70  
    71  #
    72  # BEGIN: DOCKER IN DOCKER SETUP
    73  #
    74  
    75  # Install Docker deps, some of these are already installed in the image but
    76  # that's fine since they won't re-install and we can reuse the code below
    77  # for another image someday.
    78  RUN apt-get update && apt-get install -y --no-install-recommends \
    79      apt-transport-https \
    80      ca-certificates \
    81      curl \
    82      gnupg2 \
    83      software-properties-common \
    84      lsb-release
    85  
    86  # Add the Docker apt-repository
    87  RUN curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg \
    88      | apt-key add - && \
    89      add-apt-repository \
    90      "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
    91      $(lsb_release -cs) stable"
    92  
    93  # Install Docker
    94  # TODO(bentheelder): the `sed` is a bit of a hack, look into alternatives.
    95  # Why this exists: `docker service start` on debian runs a `cgroupfs_mount` method,
    96  # We're already inside docker though so we can be sure these are already mounted.
    97  # Trying to remount these makes for a very noisy error block in the beginning of
    98  # the pod logs, so we just comment out the call to it... :shrug:
    99  # TODO(benthelder): update docker version. This is pinned because of
   100  # https://github.com/kubernetes/test-infra/issues/6187
   101  RUN apt-get update && \
   102      apt-get install -y --no-install-recommends docker-ce=17.09.1~ce-0~debian && \
   103      sed -i 's/cgroupfs_mount$/#cgroupfs_mount\n/' /etc/init.d/docker
   104  
   105  
   106  # Move Docker's storage location
   107  RUN echo 'DOCKER_OPTS="${DOCKER_OPTS} --data-root=/docker-graph"' | \
   108      tee --append /etc/default/docker
   109  # NOTE this should be mounted and persisted as a volume ideally (!)
   110  # We will make a fallback one now just in case
   111  RUN mkdir /docker-graph
   112  
   113  # add custom docker cleanup binary
   114  ADD ["./barnacle/barnacle", "/usr/local/bin"]
   115  
   116  #
   117  # END: DOCKER IN DOCKER SETUP
   118  #
   119  
   120  
   121  # note the runner is also responsible for making docker in docker function if
   122  # env DOCKER_IN_DOCKER_ENABLED is set and similarly responsible for generating
   123  # .bazelrc files if bazel remote caching is enabled 
   124  ADD ["runner", \
   125      "/workspace/"]
   126  
   127  ENTRYPOINT ["/workspace/runner"]