-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marco Franssen <[email protected]>
- Loading branch information
1 parent
6994eb4
commit b9c5ee5
Showing
2 changed files
with
45 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,38 +8,38 @@ | |
# cilium-cli is from scratch only including cilium binaries | ||
ARG FINAL_CONTAINER="cilium-cli-ci" | ||
|
||
FROM docker.io/library/golang:1.23.2-alpine3.19@sha256:f6392ffebb028fed5ffe743ddb9716e38402c978779edd66474bb5d05f5e65e4 AS builder | ||
FROM --platform=${BUILDPLATFORM} golang:1.23.0-alpine3.20@sha256:d0b31558e6b3e4cc59f6011d79905835108c919143ebecc58f35965bf79948f4 AS base | ||
RUN apk add --no-cache --update ca-certificates git make | ||
WORKDIR /go/src/github.com/cilium/cilium-cli | ||
RUN apk add --no-cache curl git make ca-certificates | ||
COPY go.* . | ||
RUN --mount=type=cache,target=/go/pkg/mod go mod download | ||
COPY . . | ||
RUN make | ||
|
||
FROM scratch AS cilium-cli | ||
ENTRYPOINT ["cilium"] | ||
COPY --from=builder --chown=root:root --chmod=755 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /go/src/github.com/cilium/cilium-cli/cilium /usr/local/bin/cilium | ||
# xx is a helper for cross-compilation | ||
# when bumping to a new version analyze the new version for security issues | ||
# then use crane to lookup the digest of that version so we are immutable | ||
# crane digest tonistiigi/xx:1.5.0 | ||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.5.0@sha256:0c6a569797744e45955f39d4f7538ac344bfb7ebf0a54006a0a4297b153ccf0f AS xx | ||
|
||
FROM --platform=${BUILDPLATFORM} base AS builder | ||
ARG TARGETPLATFORM | ||
ARG TARGETARCH | ||
COPY --link --from=xx / / | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=cache,target=/go/pkg/mod \ | ||
xx-go --wrap && \ | ||
make && \ | ||
xx-verify --static /go/src/github.com/cilium/cilium-cli/cilium | ||
|
||
FROM --platform=${BUILDPLATFORM} scratch AS cilium-cli | ||
ENTRYPOINT [""] | ||
COPY --link --from=builder --chmod=755 /go/src/github.com/cilium/cilium-cli/cilium /usr/local/bin/cilium | ||
COPY --link --from=builder --chown=root:root --chmod=755 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
|
||
FROM ubuntu:24.04@sha256:99c35190e22d294cdace2783ac55effc69d32896daaa265f0bbedbcde4fbe3e5 AS cilium-cli-ci | ||
ENTRYPOINT [] | ||
COPY --from=builder /go/src/github.com/cilium/cilium-cli/cilium /usr/local/bin/cilium | ||
ENTRYPOINT [] | ||
|
||
# Install cloud CLIs. Based on these instructions: | ||
# - https://cloud.google.com/sdk/docs/install#deb | ||
# - https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html | ||
# - https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#install-azure-cli | ||
RUN apt-get update -y \ | ||
&& apt-get install -y curl gnupg unzip \ | ||
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \ | ||
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \ | ||
&& echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ | ||
&& apt-get update -y \ | ||
&& apt-get install -y google-cloud-cli google-cloud-sdk-gke-gcloud-auth-plugin kubectl \ | ||
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ | ||
&& unzip awscliv2.zip \ | ||
&& ./aws/install \ | ||
&& rm -r ./aws awscliv2.zip \ | ||
&& curl -sL https://aka.ms/InstallAzureCLIDeb | bash | ||
|
||
FROM ${FINAL_CONTAINER} | ||
FROM ${FINAL_CONTAINER} | ||
LABEL maintainer="[email protected]" | ||
WORKDIR /root/app |