k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/images/gcloud-terraform/Dockerfile (about)

     1  # Copyright 2021 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 gcr.io/k8s-prow/alpine:v20240108-a28886d2bd
    16  
    17  # add env we can debug with the image name:tag
    18  ARG IMAGE_ARG
    19  ENV IMAGE=${IMAGE_ARG}
    20  
    21  # Install utilities and dependencies
    22  #
    23  # Terraform requires `git` to be on the PATH for downloading modules from
    24  # GitHub.
    25  RUN apk update && apk add --no-cache \
    26      bash \
    27      git \
    28      jq \
    29      python3 \
    30      make \
    31      rsync \
    32      wget \
    33      curl && \
    34      rm -rf /var/lib/apt/lists/*
    35  
    36  # Install gcloud
    37  ENV PATH=/google-cloud-sdk/bin:/workspace:${PATH} \
    38      CLOUDSDK_CORE_DISABLE_PROMPTS=1
    39  WORKDIR /workspace
    40  
    41  RUN wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz && \
    42      tar xzf google-cloud-sdk.tar.gz -C / && \
    43      rm google-cloud-sdk.tar.gz && \
    44      /google-cloud-sdk/install.sh \
    45          --disable-installation-options \
    46          --bash-completion=false \
    47          --path-update=false \
    48          --usage-reporting=false && \
    49      gcloud components install alpha beta kubectl && \
    50      gcloud info | tee /workspace/gcloud-info.txt
    51  
    52  # Install latest terraform version directly from HashiCorp, because Alpine Linux
    53  # packages lag behind the latest versions (and we get a warning from terraform
    54  # itself when it detects that it is not the latest version).
    55  RUN version=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | jq -r .tag_name` \
    56      && version=${version#v} \
    57      && wget https://releases.hashicorp.com/terraform/${version}/terraform_${version}_linux_amd64.zip \
    58      && unzip terraform_${version}_linux_amd64.zip \
    59      && mv terraform /usr/bin/terraform
    60  
    61  ENTRYPOINT ["/bin/bash"]