Skip to content

Commit

Permalink
extensions/Dockerfile: Get extensions rpm list
Browse files Browse the repository at this point in the history
 - Generate JSON file listing installed extension packages;
 - Use dnf repoquery to list 'name: version,' for each RPM
and generates a JSON file at `/tmp/extensions.json`. Where the
build volume is mounted;
 - It is needed to generated the extensions package list in meta.json.

Signed-off-by: Renata Ravanelli <[email protected]>
  • Loading branch information
ravanelli committed Jan 30, 2025
1 parent d84188a commit 128a6b9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions extensions/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ RUN rm -f /etc/yum.repos.d/*.repo \
RUN dnf install -y createrepo_c
RUN createrepo_c /usr/share/rpm-ostree/extensions/

# Generate extensions.json for meta.json, written to a bind-mounted path during the build.
# Use dnf repoquery to print 'name: version,' for each RPM
# sed to remove the comma from the last RPM
RUN sh -c 'echo "{" > /tmp/extensions.json && \
dnf repoquery --repofrompath=extensions,/usr/share/rpm-ostree/extensions/ \
--quiet --disablerepo=* --enablerepo=extensions \
--queryformat "\"%{name}\": \"%{version}\"," | \
sed "$ s/,$//" >> /tmp/extensions.json && \
echo "}" >> /tmp/extensions.json'

## Final container that has the extensions repo dir
FROM registry.access.redhat.com/ubi9/ubi:latest
COPY --from=builder /usr/share/rpm-ostree/extensions/ /usr/share/rpm-ostree/extensions/

0 comments on commit 128a6b9

Please sign in to comment.