Skip to content

Commit

Permalink
Add cilium-cli image
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Franssen <marco.franssen@gmail.com>
  • Loading branch information
marcofranssen committed Sep 2, 2024
1 parent 80ead2d commit 2bf1e74
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ jobs:
include:
- name: cilium-cli-ci
dockerfile: ./Dockerfile.ci
- name: cilium-cli
dockerfile: ./Dockerfile

env:
DOCKER_PLATFORM: ${{ matrix.name == 'cilium-cli' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
Expand Down Expand Up @@ -63,7 +69,7 @@ jobs:
context: .
file: ${{ matrix.dockerfile }}
push: true
platforms: linux/amd64
platforms: ${{ env.DOCKER_PLATFORM }}
tags: |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}:latest
quay.io/${{ github.repository_owner }}/${{ matrix.name }}:${{ steps.tag.outputs.tag }}
Expand All @@ -85,7 +91,7 @@ jobs:
context: .
file: ${{ matrix.dockerfile }}
push: true
platforms: linux/amd64
platforms: ${{ env.DOCKER_PLATFORM }}
tags: |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}:${{ steps.tag.outputs.tag }}
Expand Down
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# syntax=docker/dockerfile:1.9@sha256:fe40cf4e92cd0c467be2cfc30657a680ae2398318afd50b0c80585784c604f28

# Copyright Authors of Cilium
# SPDX-License-Identifier: Apache-2.0
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
COPY go.* .
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY . .

# 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.3.0
FROM --platform=$BUILDPLATFORM tonistiigi/xx@sha256:904fe94f236d36d65aeb5a2462f88f2c537b8360475f6342e7599194f291fb7e 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} cgr.dev/chainguard/wolfi-base:latest@sha256:72c8bfed3266b2780243b144dc5151150015baf5a739edbbde53d154574f1607
LABEL maintainer="maintainer@cilium.io"
ENTRYPOINT [""]
CMD ["bash"]
ARG cilium_uid=1000
ARG cilium_gid=1000
ARG cilium_home=/home/cilium
RUN apk add --update --no-cache bash busybox kubectl && \
addgroup -g ${cilium_gid} cilium && \
adduser -D -h ${cilium_home} -u ${cilium_uid} -G cilium cilium
WORKDIR ${cilium_home}
COPY --link --from=builder --chown=${cilium_uid}:${cilium_gid} --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/
USER ${cilium_uid}:${cilium_gid}

0 comments on commit 2bf1e74

Please sign in to comment.