-
Notifications
You must be signed in to change notification settings - Fork 17
/
Containerfile
42 lines (33 loc) · 1.18 KB
/
Containerfile
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
38
39
40
41
42
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}"
FROM registry.fedoraproject.org/fedora:${FEDORA_MAJOR_VERSION} AS builder
ENV UBLUE_ROOT=/app/output
WORKDIR /app
ADD . /app
RUN dnf install \
--disablerepo='*' \
--enablerepo='fedora,updates' \
--setopt install_weak_deps=0 \
--nodocs \
--assumeyes \
'dnf-command(builddep)' \
rpkg \
rpm-build && \
mkdir -p "$UBLUE_ROOT" && \
rpkg spec --outdir "$UBLUE_ROOT" && \
dnf builddep -y output/ublue-update.spec && \
make build-rpm
# Dump a file list for each RPM for easier consumption
RUN \
for RPM in ${UBLUE_ROOT}/noarch/*.rpm; do \
NAME="$(rpm -q $RPM --queryformat='%{NAME}')"; \
mkdir -p "${UBLUE_ROOT}/ublue-os/files/${NAME}"; \
rpm2cpio "${RPM}" | cpio -idmv --directory "${UBLUE_ROOT}/ublue-os/files/${NAME}"; \
mkdir -p ${UBLUE_ROOT}/ublue-os/rpms/; \
cp "${RPM}" "${UBLUE_ROOT}/ublue-os/rpms/$(rpm -q "${RPM}" --queryformat='%{NAME}.%{ARCH}.rpm')"; \
done
FROM scratch
ENV UBLUE_ROOT=/app/output
# Copy RPMs
COPY --from=builder ${UBLUE_ROOT}/ublue-os/rpms /rpms
# Copy dumped contents
COPY --from=builder ${UBLUE_ROOT}/ublue-os/files /files