-
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
ccc772f
commit 0a6057e
Showing
2 changed files
with
35 additions
and
17 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 |
---|---|---|
|
@@ -3,26 +3,41 @@ | |
# Copyright Authors of Cilium | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
FROM docker.io/library/golang:1.23.3-alpine3.19@sha256:f72297ec1cf35152ecfe7a4d692825fc608fea8f3d3fa8f986fda70184082823 AS builder | ||
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.23.3-alpine3.19@sha256:f72297ec1cf35152ecfe7a4d692825fc608fea8f3d3fa8f986fda70184082823 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 | ||
|
||
# xx is a helper for cross-compilation | ||
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 | ||
|
||
# cilium-cli is from scratch only including cilium binaries | ||
FROM scratch AS cilium-cli | ||
ENTRYPOINT ["cilium"] | ||
FROM --platform=${BUILDPLATFORM} scratch AS cilium-cli | ||
ENTRYPOINT [""] | ||
USER 1000:1000 | ||
LABEL maintainer="[email protected]" | ||
WORKDIR /root/app | ||
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 | ||
COPY --link --from=builder --chown=root:root --chmod=755 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --link --from=builder --chown=1000:1000 --chmod=755 /go/src/github.com/cilium/cilium-cli/cilium /usr/local/bin/cilium | ||
|
||
# cilium-cli-ci is based on ubuntu with cloud CLIs | ||
FROM ubuntu:24.04@sha256:99c35190e22d294cdace2783ac55effc69d32896daaa265f0bbedbcde4fbe3e5 AS cilium-cli-ci | ||
ENTRYPOINT [] | ||
LABEL maintainer="[email protected]" | ||
WORKDIR /root/app | ||
COPY --from=builder /go/src/github.com/cilium/cilium-cli/cilium /usr/local/bin/cilium | ||
COPY --link --from=builder /go/src/github.com/cilium/cilium-cli/cilium /usr/local/bin/cilium | ||
|
||
# Install cloud CLIs. Based on these instructions: | ||
# - https://cloud.google.com/sdk/docs/install#deb | ||
|