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

     1  # Copyright 2020 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 Dockerfile uses multi-stage builds. The first stage builds Triage and gathers the Google
    16  # Cloud SDK, and the resulting files are then used in the second stage.
    17  
    18  # Stage 1
    19  FROM golang:1.18 AS build
    20  
    21  # Install the Google Cloud SDK
    22  RUN curl -o installer https://sdk.cloud.google.com \
    23      && bash installer --disable-prompts --install-dir=/ \
    24      && rm installer
    25  
    26  # Build Triage
    27  COPY . /test-infra/triage
    28  WORKDIR /test-infra/triage
    29  RUN env GOOS=linux \
    30           CGO_ENABLED=0 \
    31           GO111MODULE=on \
    32           GOPROXY=https://proxy.golang.org \
    33           GOSUMDB=sum.golang.org \
    34           go build -v -o triage ./main.go
    35  
    36  
    37  # Stage 2
    38  FROM alpine:3.15.6
    39  
    40  # Google Cloud SDK requires python 3.9+ (https://cloud.google.com/python/setup#installing_the_cloud_sdk).
    41  # update_summaries.sh requires bash.
    42  RUN apk add --no-cache \
    43      python3 \
    44      bash
    45  
    46  # Copy the Google Cloud SDK and link the binaries
    47  COPY --from=build /google-cloud-sdk/ /google-cloud-sdk/
    48  RUN ln -s /google-cloud-sdk/bin/* /bin/
    49  
    50  # Copy over the triage binary and shell script that orchestrates everything
    51  COPY --from=build /test-infra/triage/triage /
    52  COPY --from=build /test-infra/triage/update_summaries.sh /
    53  
    54  ENTRYPOINT ["timeout", "10800", "/update_summaries.sh"]