Skip to content

Commit 261beb6

Browse files
authored
Merge pull request #265 from ErikJiang/update_rh8_dockerfile
Select CENTOS8 as a container environment for making an RH8 offline package
2 parents 3f714d6 + 198607c commit 261beb6

File tree

3 files changed

+40
-38
lines changed

3 files changed

+40
-38
lines changed

build/os-packages/Dockerfile.centos8

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
FROM redhat/ubi8:8.6 as os-redhat8
1+
FROM centos:8 as os-redhat8
22
ARG OS_VERSION=8
3-
ARG BUILD_TOOLS="yum-utils createrepo wget"
4-
ARG RHEL_REG_USER
5-
ARG RHEL_REG_PASS
3+
ARG BUILD_TOOLS="yum-utils createrepo epel-release wget"
64

7-
RUN subscription-manager register --username ${RHEL_REG_USER} --password ${RHEL_REG_PASS} --auto-attach
8-
9-
RUN ARCH=$(uname -m) \
10-
&& yum install -q -y ${BUILD_TOOLS} \
11-
&& yum install -q -y http://mirror.centos.org/centos/8-stream/extras/${ARCH}/os/Packages/epel-release-8-11.el8.noarch.rpm \
12-
&& yum install -q -y http://mirror.centos.org/centos/8-stream/AppStream/${ARCH}/os/Packages/modulemd-tools-0.7-6.el8.noarch.rpm \
5+
RUN ARCH=$(uname -m) \
6+
&& dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos -y \
7+
&& dnf distro-sync -y \
8+
&& dnf install -q -y ${BUILD_TOOLS} \
9+
&& dnf install -q -y http://mirror.centos.org/centos/8-stream/AppStream/${ARCH}/os/Packages/modulemd-tools-0.7-4.el8.noarch.rpm \
1310
&& yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo \
14-
&& yum makecache
11+
&& dnf makecache
1512

16-
WORKDIR /redhat/$OS_VERSION/os
13+
WORKDIR /centos/$OS_VERSION/os
1714
COPY build/os-packages/packages.yml .
1815
COPY --from=mikefarah/yq:4.27.2 /usr/bin/yq /usr/bin/yq
1916
RUN yq eval '.base[],.extras[],.docker.redhat8[]' packages.yml > packages.list
@@ -25,4 +22,4 @@ RUN ARCH=$(uname -m) \
2522
&& modifyrepo_c --mdtype=modules ${ARCH}/modules.yaml ${ARCH}/repodata
2623

2724
FROM scratch
28-
COPY --from=os-redhat8 /redhat /resources/redhat
25+
COPY --from=os-redhat8 /centos /resources/centos
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM redhat/ubi8:8.6 as os-redhat8
2+
ARG OS_VERSION=8
3+
ARG BUILD_TOOLS="yum-utils createrepo wget"
4+
ARG RHEL_REG_USER
5+
ARG RHEL_REG_PASS
6+
7+
ENV SMDEV_CONTAINER_OFF=1
8+
9+
RUN subscription-manager register --username ${RHEL_REG_USER} --password ${RHEL_REG_PASS} --auto-attach
10+
11+
RUN ARCH=$(uname -m) \
12+
&& yum install -q -y ${BUILD_TOOLS} \
13+
&& yum install -q -y http://mirror.centos.org/centos/8-stream/extras/${ARCH}/os/Packages/epel-release-8-11.el8.noarch.rpm \
14+
&& yum install -q -y http://mirror.centos.org/centos/8-stream/AppStream/${ARCH}/os/Packages/modulemd-tools-0.7-6.el8.noarch.rpm \
15+
&& yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo \
16+
&& yum makecache
17+
18+
WORKDIR /redhat/$OS_VERSION/os
19+
COPY build/os-packages/packages.yml .
20+
COPY --from=mikefarah/yq:4.27.2 /usr/bin/yq /usr/bin/yq
21+
RUN yq eval '.base[],.extras[],.docker.redhat8[]' packages.yml > packages.list
22+
23+
RUN ARCH=$(uname -m) \
24+
&& while read -r line; do yum install -y --downloadonly --downloaddir=${ARCH} ${line}; done <<<"$(sort -u packages.list)" \
25+
&& createrepo_c ${ARCH} \
26+
&& repo2module -s stable ${ARCH} ${ARCH}/modules.yaml \
27+
&& modifyrepo_c --mdtype=modules ${ARCH}/modules.yaml ${ARCH}/repodata
28+
29+
FROM scratch
30+
COPY --from=os-redhat8 /redhat /resources/redhat

0 commit comments

Comments
 (0)