github.com/helmwave/helmwave@v0.36.4-0.20240509190856-b35563eba4c6/Dockerfile (about)

     1  ARG GOLANG_VERSION=1.22
     2  ARG ALPINE_VERSION=3.19
     3  
     4  FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder
     5  ENV GO111MODULE=on
     6  ENV CGO_ENABLED=0
     7  ENV PROJECT=helmwave
     8  
     9  WORKDIR ${PROJECT}
    10  
    11  COPY go.mod go.sum ./
    12  RUN go mod download
    13  
    14  # Copy src code from the host and compile it
    15  COPY cmd cmd
    16  COPY pkg pkg
    17  RUN go build -a -o /${PROJECT} ./cmd/${PROJECT}
    18  
    19  ### Base image with shell
    20  FROM alpine:${ALPINE_VERSION} as base-release
    21  RUN apk --update --no-cache add ca-certificates && update-ca-certificates
    22  ENTRYPOINT ["/bin/helmwave"]
    23  
    24  ### Base image with shell and debugging tools
    25  FROM base-release as base-debug-release
    26  RUN apk --update --no-cache add jq bash
    27  COPY --chown=root:root --chmod=0775 --from=bitnami/kubectl:latest /opt/bitnami/kubectl/bin/kubectl /bin/kubectl
    28  
    29  ### Build with goreleaser
    30  FROM base-release as goreleaser
    31  COPY helmwave /bin/
    32  
    33  ### Debug tag
    34  FROM base-debug-release as debug-goreleaser
    35  COPY helmwave /bin/
    36  
    37  ### Build in docker
    38  FROM base-release as release
    39  COPY --from=builder /helmwave /bin/
    40  
    41  ### Scratch with build in docker
    42  FROM scratch as scratch-release
    43  COPY --from=base-release /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
    44  COPY --from=builder /helmwave /bin/
    45  ENTRYPOINT ["/bin/helmwave"]
    46  USER 65534
    47  
    48  ### Scratch with goreleaser
    49  FROM scratch as scratch-goreleaser
    50  COPY --from=base-release /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
    51  COPY helmwave /bin/
    52  ENTRYPOINT ["/bin/helmwave"]
    53  USER 65534