Skip to content

Commit ec1881a

Browse files
committed
Add Red Hat UBI image
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 7a19810 commit ec1881a

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

.github/workflows/push-ubi.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: push-ubi
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
contents: read
7+
8+
env:
9+
CONTROLLER: ${{ github.event.repository.name }}
10+
11+
jobs:
12+
flux-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write # for creating OIDC tokens for signing.
16+
packages: write # for pushing and signing container images.
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
20+
- name: Prepare
21+
id: prep
22+
run: |
23+
RELEASE=$(gh release view --json tagName -q '.tagName')
24+
echo "VERSION=${RELEASE}" >> $GITHUB_OUTPUT
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Setup QEMU
28+
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
29+
- name: Setup Docker Buildx
30+
id: buildx
31+
uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0
32+
- name: Login to GitHub Container Registry
33+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Generate images meta
39+
id: meta
40+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
41+
with:
42+
images: |
43+
ghcr.io/controlplaneio-fluxcd/${{ env.CONTROLLER }}
44+
tags: |
45+
type=raw,value=${{ steps.prep.outputs.VERSION }}-ubi
46+
- name: Publish images
47+
id: build-push
48+
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0
49+
with:
50+
sbom: true
51+
provenance: true
52+
push: true
53+
builder: ${{ steps.buildx.outputs.name }}
54+
context: .
55+
file: ./config/olm/build/Dockerfile
56+
platforms: linux/amd64,linux/arm64
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
build-args: "VERSION=${{ steps.prep.outputs.VERSION }}"
60+
- uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
61+
- name: Sign images
62+
env:
63+
COSIGN_EXPERIMENTAL: 1
64+
run: |
65+
cosign sign --yes ghcr.io/controlplaneio-fluxcd/${{ env.CONTROLLER }}@${{ steps.build-push.outputs.digest }}

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
110110
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
111111
- $(CONTAINER_TOOL) buildx rm flux-operator-builder
112112

113+
docker-build-ubi: ## Build docker image with the manager using UBI base image.
114+
$(CONTAINER_TOOL) build -t ${IMG}-ubi --build-arg VERSION=$(FLUX_OPERATOR_VERSION) -f config/olm/build/Dockerfile .
115+
113116
.PHONY: build-installer
114117
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
115118
mkdir -p dist

config/olm/build/Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ARG VERSION
2+
3+
FROM --platform=${BUILDPLATFORM} ghcr.io/controlplaneio-fluxcd/flux-operator:${VERSION} AS distroless
4+
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi8/ubi-minimal
5+
6+
### Required OpenShift Labels
7+
LABEL name="flux-operator" \
8+
vendor="ControlPlane" \
9+
version="${VERSION}" \
10+
release="1" \
11+
summary="This is the flux-operator image." \
12+
description="This image contains the operator of ControlPlane Enterprise for Flux."
13+
14+
WORKDIR /
15+
16+
# Copy the license.
17+
COPY LICENSE /licenses/LICENSE.txt
18+
19+
# Copy the manifests data.
20+
COPY config/data/ /data/
21+
22+
# Copy the operator binary.
23+
COPY --from=distroless flux-operator .
24+
25+
# Run the operator as the default user.
26+
ENTRYPOINT ["/flux-operator"]

0 commit comments

Comments
 (0)