Skip to content

Commit 2da23f1

Browse files
Merge pull request #2556 from celebdor/operatorhub
HIVE-2764: Upstream builds for operatorhub
2 parents 3d385a5 + 8829bb0 commit 2da23f1

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ ARG BASE_IMAGE=${BASE_IMAGE:-registry.ci.openshift.org/ocp/4.19:base-rhel9}
55

66
FROM ${EL8_BUILD_IMAGE} as builder_rhel8
77
ARG GO=${GO:-go}
8+
ARG BUILD_IMAGE_CUSTOMIZATION
89
RUN mkdir -p /go/src/github.com/openshift/hive
910
WORKDIR /go/src/github.com/openshift/hive
1011
COPY . .
1112

13+
RUN if [ -f "${BUILD_IMAGE_CUSTOMIZATION}" ]; then "${BUILD_IMAGE_CUSTOMIZATION}"; fi
1214

1315
RUN if [ -e "/activation-key/org" ]; then unlink /etc/rhsm-host; subscription-manager register --force --org $(cat "/activation-key/org") --activationkey $(cat "/activation-key/activationkey"); fi
1416
RUN python3 -m ensurepip
@@ -18,10 +20,13 @@ RUN make build-hiveutil
1820
FROM ${EL9_BUILD_IMAGE} as builder_rhel9
1921
ARG GO=${GO:-go}
2022
ARG CONTAINER_SUB_MANAGER_OFF
23+
ARG BUILD_IMAGE_CUSTOMIZATION
2124
RUN mkdir -p /go/src/github.com/openshift/hive
2225
WORKDIR /go/src/github.com/openshift/hive
2326
COPY . .
2427

28+
RUN if [ -f "${BUILD_IMAGE_CUSTOMIZATION}" ]; then "${BUILD_IMAGE_CUSTOMIZATION}"; fi
29+
2530
ENV SMDEV_CONTAINER_OFF=${CONTAINER_SUB_MANAGER_OFF}
2631
RUN if [ -e "/activation-key/org" ]; then unlink /etc/rhsm-host; subscription-manager register --force --org $(cat "/activation-key/org") --activationkey $(cat "/activation-key/activationkey"); fi
2732
RUN python3 -m ensurepip
@@ -44,7 +49,7 @@ RUN if ! rpm -q openssh-clients; then dnf install -y openssh-clients && dnf clea
4449
RUN if ! rpm -q libvirt-libs; then dnf install -y libvirt-libs && dnf clean all && rm -rf /var/cache/dnf/*; fi
4550

4651
# tar is needed to package must-gathers on install failure
47-
RUN if ! which tar; then dnf install -y tar && dnf clean all && rm -rf /var/cache/dnf/*; fi
52+
RUN if ! command -v tar; then dnf install -y tar && dnf clean all && rm -rf /var/cache/dnf/*; fi
4853

4954
COPY --from=builder_rhel9 /go/src/github.com/openshift/hive/bin/manager /opt/services/
5055
COPY --from=builder_rhel9 /go/src/github.com/openshift/hive/bin/hiveadmission /opt/services/

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,14 @@ buildah-dev-build:
318318
podman-dev-build:
319319
podman build --tag ${IMG} $(GOCACHE_VOL_ARG) -f ./Dockerfile .
320320

321+
podman-operatorhub-build:
322+
podman build --tag ${IMG} ${GOCACHE_VOL_ARG} \
323+
--build-arg=BASE_IMAGE=quay.io/centos/centos:stream9 \
324+
--build-arg=BUILD_IMAGE_CUSTOMIZATION=./hack/ubi-build-deps.sh \
325+
--build-arg=EL8_BUILD_IMAGE=registry.access.redhat.com/ubi8/ubi:8.10 \
326+
--build-arg=EL9_BUILD_IMAGE=registry.access.redhat.com/ubi9:9.5 \
327+
-f ./Dockerfile .
328+
321329
# Build and push the dev image with buildah
322330
.PHONY: buildah-dev-push
323331
buildah-dev-push: buildah-dev-build

hack/ubi-build-deps.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
dnf install -y \
3+
git \
4+
golang \
5+
make \
6+
python3

0 commit comments

Comments
 (0)