-
Notifications
You must be signed in to change notification settings - Fork 130
Expand file tree
/
Copy pathContainerfile
More file actions
37 lines (35 loc) · 1.62 KB
/
Copy pathContainerfile
File metadata and controls
37 lines (35 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Downloads the extensions given the extensions.yaml
ARG IMAGE_FROM=overridden
FROM ${IMAGE_FROM} as os
RUN mkdir /os
WORKDIR /os
ADD . .
ARG OPENSHIFT_CI=0
ARG YUM_REPO_NAMES=overridden
ARG EXTENSIONS_YUM_REPO_NAMES=overridden
RUN --mount=type=secret,id=yumrepos,target=/os/secret.repo extensions/build.sh
## Creates the repo metadata for the extensions.
FROM quay.io/centos/centos:stream9 as builder
COPY --from=os /usr/share/rpm-ostree/extensions/ /usr/share/rpm-ostree/extensions/
RUN dnf install -y createrepo_c
RUN createrepo_c /usr/share/rpm-ostree/extensions/
# Generate extensions.json for meta.json.
# Use dnf repoquery to print 'name: version,' for each RPM
# sed to remove the comma from the last RPM
RUN (echo "{" && \
(dnf repoquery --repofrompath=extensions,/usr/share/rpm-ostree/extensions/ \
--quiet --disablerepo=* --enablerepo=extensions \
--queryformat "\"%{name}\": \"%{evr}.%{arch}\"," | \
sed "$ s/,$//") && echo "}") >> /usr/share/rpm-ostree/extensions.json
## Final container that has the extensions repo dir
FROM registry.access.redhat.com/ubi9/ubi:latest
# Add a label so the extensions image can be identified
LABEL io.openshift.os.extensions=true
# Identify the stream this extensions image is related to
ARG STREAM_CLASS
LABEL io.openshift.os.streamclass=${STREAM_CLASS}
# Copy in the extensions repo
COPY --from=builder /usr/share/rpm-ostree/extensions/ /usr/share/rpm-ostree/extensions/
# Make this the last layer, this is similar to the metalayer trick in the node
# image, but this one is specific to rpm-ostree extensions.
COPY --from=builder /usr/share/rpm-ostree/extensions.json /usr/share/rpm-ostree/extensions.json