@@ -19,16 +19,16 @@ USER root
19
19
# the build process assumes go is under "/go", so let's make sure it works
20
20
RUN ln -s /opt/app-root/src/go /go
21
21
RUN go install github.com/mikefarah/yq/v4@$YQ_VERSION
22
- ARG ORG_ID
23
- ARG ACTIVATION_KEY
22
+
24
23
# This registering RHEL when building on an unsubscribed system
25
24
# If you are running a UBI container on a registered and subscribed RHEL host,
26
25
# the main RHEL Server repository is enabled inside the standard UBI container.
27
- # Uncomment this and provide the associated ARG variables to register.
28
- RUN if [[ -n "${ACTIVATION_KEY}" && -n "${ORG_ID}" ]]; then \
26
+ RUN if command -v subscription-manager; then \
29
27
REPO_ARCH=$(uname -m) && \
30
- subscription-manager register --org=${ORG_ID} -- activationkey=${ACTIVATION_KEY} && \
28
+ subscription-manager register --org "$(cat /activation-key/org)" -- activationkey "$(cat /activation-key/activationkey)" && \
31
29
subscription-manager repos --enable rhel-9-for-${REPO_ARCH}-appstream-rpms --enable codeready-builder-for-rhel-9-${REPO_ARCH}-rpms; \
30
+ else \
31
+ dnf -y install 'dnf-command(config-manager)' && dnf config-manager --enable crb; \
32
32
fi
33
33
34
34
# For `dev` builds due to CGO constraints we have to emulate the target platform
@@ -79,11 +79,13 @@ RUN --mount=type=bind,target=/versions.yaml,source=cloud-api-adaptor/versions.ya
79
79
80
80
FROM registry.access.redhat.com/ubi9/ubi:9.5 AS base-release
81
81
USER root
82
- ARG ORG_ID
83
- ARG ACTIVATION_KEY
84
- RUN REPO_ARCH=$(uname -m) && \
85
- subscription-manager register --org=${ORG_ID} --activationkey=${ACTIVATION_KEY} && \
86
- subscription-manager repos --enable rhel-9-for-${REPO_ARCH}-appstream-rpms --enable codeready-builder-for-rhel-9-${REPO_ARCH}-rpms
82
+ RUN if command -v subscription-manager; then \
83
+ REPO_ARCH=$(uname -m) && \
84
+ subscription-manager register --org "$(cat /activation-key/org)" --activationkey "$(cat /activation-key/activationkey)" && \
85
+ subscription-manager repos --enable rhel-9-for-${REPO_ARCH}-appstream-rpms --enable codeready-builder-for-rhel-9-${REPO_ARCH}-rpms; \
86
+ else \
87
+ dnf -y install 'dnf-command(config-manager)' && dnf config-manager --enable crb; \
88
+ fi
87
89
88
90
RUN dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y
89
91
RUN dnf install -y iptables iptables-legacy iptables-nft nftables && dnf clean all
0 commit comments