Skip to content

Commit

Permalink
rpm: minimal RHEL support
Browse files Browse the repository at this point in the history
Signed-off-by: Bjorn Neergaard <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit 29bfe29)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
neersighted authored and thaJeztah committed Jul 23, 2024
1 parent 0e46810 commit 9b1fc8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ build:

@set -x; DOCKER_BUILDKIT=1 docker build \
--pull \
--secret id=rh-user,env=RH_USER \
--secret id=rh-pass,env=RH_PASS \
--platform linux/$(ARCH) \
--build-arg GOLANG_IMAGE="$(GOLANG_IMAGE)" \
--build-arg BUILD_IMAGE="$(BUILD_IMAGE)" \
Expand Down
13 changes: 13 additions & 0 deletions dockerfiles/rpm.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ FROM ${BUILD_IMAGE} AS redhat-base
RUN yum install -y yum-utils rpm-build git

FROM redhat-base AS rhel-base
RUN --mount=type=secret,id=rh-user --mount=type=secret,id=rh-pass <<-EOT
rm -f /etc/rhsm-host

if [ ! -f /run/secrets/rh-user ] || [ ! -f /run/secrets/rh-pass ]; then
echo "Either RH_USER or RH_PASS is not set. Running build without subscription."
else
subscription-manager register \
--username="$(cat /run/secrets/rh-user)" \
--password="$(cat /run/secrets/rh-pass)"

subscription-manager repos --enable codeready-builder-for-rhel-$(source /etc/os-release && echo "${VERSION_ID%.*}"-$(arch)-rpms)
fi
EOT

FROM redhat-base AS centos-base
# Using a wildcard: CentOS 7 uses "CentOS-RepoName", CentOS 8 uses "CentOS-Linux-RepoName"
Expand Down

0 comments on commit 9b1fc8f

Please sign in to comment.