github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/images/kubekins-e2e/Dockerfile (about)

     1  # Copyright 2016 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  # This file creates a build environment for building and running kubernetes
    16  # unit and integration tests
    17  
    18  FROM gcr.io/k8s-testimages/bootstrap:v20181219-899fabec7
    19  LABEL maintainer "Sen Lu <senlu@google.com>"
    20  
    21  # hint to kubetest that it is in CI
    22  ENV KUBETEST_IN_DOCKER="true"
    23  
    24  # Go standard envs
    25  ENV GOPATH /go
    26  ENV PATH /usr/local/go/bin:$PATH
    27  
    28  RUN mkdir -p /go/bin
    29  ENV PATH $GOPATH/bin:$PATH
    30  
    31  # setup k8s repo symlink
    32  RUN mkdir -p /go/src/k8s.io/kubernetes \
    33      && ln -s /go/src/k8s.io/kubernetes /workspace/kubernetes
    34  
    35  # preinstall:
    36  # - graphviz package for graphing profiles
    37  # - bc for shell to junit
    38  # - rpm for building RPMs with Bazel
    39  RUN apt-get install -y bc \
    40      graphviz \
    41      rpm
    42  # preinstall this for kops tests xref kubetest prepareAws(...)
    43  # TODO(bentheelder,krzyzacy,justisb,chrislovecnm): remove this
    44  RUN pip install awscli
    45  
    46  # install cfssl to prevent https://github.com/kubernetes/kubernetes/issues/55589
    47  # The invocation at the end is to prevent download failures downloads as in the bug.
    48  # TODO(porridge): bump CFSSL_VERSION to one where cfssljson supports the -version flag and test it as well.
    49  ARG CFSSL_VERSION
    50  RUN wget -q -O cfssl "https://pkg.cfssl.org/${CFSSL_VERSION}/cfssl_linux-amd64" && \
    51      wget -q -O cfssljson "https://pkg.cfssl.org/${CFSSL_VERSION}/cfssljson_linux-amd64" && \
    52      chmod +x cfssl cfssljson && \
    53      mv cfssl cfssljson /usr/local/bin && \
    54      cfssl version
    55  
    56  # install go
    57  ARG GO_VERSION
    58  ENV GO_TARBALL "go${GO_VERSION}.linux-amd64.tar.gz"
    59  RUN wget -q "https://storage.googleapis.com/golang/${GO_TARBALL}" && \
    60      tar xzf "${GO_TARBALL}" -C /usr/local && \
    61      rm "${GO_TARBALL}"
    62  
    63  # install bazel
    64  ARG BAZEL_VERSION_ARG
    65  ENV BAZEL_VERSION=${BAZEL_VERSION_ARG}
    66  COPY ./install-bazel.sh /
    67  RUN bash /install-bazel.sh
    68  
    69  # if UPGRADE_DOCKER_ARG, then install the latest docker over whatever we have
    70  # in the base image.
    71  # TODO(bentheelder): after code freeze, roll out newer docker in the
    72  # base image and possibly remove this ...
    73  ARG UPGRADE_DOCKER_ARG=false
    74  RUN [ "${UPGRADE_DOCKER_ARG}" = "true" ] && \
    75      apt-get install -y --no-install-recommends docker-ce && \
    76      sed -i 's/cgroupfs_mount$/#cgroupfs_mount\n/' /etc/init.d/docker || true
    77  
    78  # add env we can debug with the image name:tag
    79  ARG IMAGE_ARG
    80  ENV IMAGE=${IMAGE_ARG}
    81  
    82  # everything below will be triggered on every new image tag ...
    83  ADD ["kops-e2e-runner.sh", \
    84      "kubetest", \
    85      "https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/get-kube.sh", \
    86      "/workspace/"]
    87  RUN ["chmod", "+x", "/workspace/get-kube.sh"]