github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/planter/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  FROM debian:jessie
    16  LABEL maintainer="Benjamin Elder <bentheelder@google.com>"
    17  
    18  # Includes everything needed to build and test github.com/kubernetes/kubernetes
    19  # and github.com/kubernetes/test-infra with bazel and run bazel as the host UID
    20  
    21  ARG BAZEL_VERSION
    22  
    23  WORKDIR "/workspace"
    24  RUN mkdir -p "/workspace"
    25  
    26  # TODO(bentheelder): we should probably have these pip deps in bazel,
    27  # remove these from the container if kettle is fixed.
    28  RUN apt-get update && apt-get install -y --no-install-recommends \
    29      build-essential \
    30      ca-certificates \
    31      git \
    32      python \
    33      python-pip \
    34      rpm \
    35      unzip \
    36      wget \
    37      zip \
    38      zlib1g-dev \
    39      && apt-get clean && \
    40      python -m pip install --upgrade pip setuptools wheel && \
    41      pip install pylint pyyaml
    42  
    43  SHELL ["/bin/bash", "-c"]
    44  
    45  # install bazel as some non-root user
    46  RUN useradd -ms /bin/bash install-user
    47  COPY ./install-bazel.sh /
    48  RUN chmod +rx /install-bazel.sh && \
    49      cd /home/install-user && \
    50      su install-user /install-bazel.sh
    51  # make sure bazel is in $PATH
    52  ENV PATH="/home/install-user/bin:${PATH}"
    53  
    54  # It turns out git and bazel pkg_tar and a bunch of other things fail if we
    55  # don't have a /etc/passwd with the user in it, so let's solve that.
    56  # We're making a fake world-writable one *inside* the container so that the
    57  # entrypoint can write an entry to it with the user matching the host user
    58  # this means we don't need to run the container as root! :-)
    59  # We care about not running as root because it means build files are owned by
    60  # the host users, not root (and logs, etc).
    61  # More about this in entrypoint.sh
    62  RUN touch /etc/passwd && chmod a+rw /etc/passwd
    63  
    64  COPY ./entrypoint.sh /
    65  RUN chmod +rx /entrypoint.sh
    66  
    67  ENTRYPOINT ["/entrypoint.sh"]