Skip to content

Commit

Permalink
Tweak Dockerfile to use dnf4/5 builders
Browse files Browse the repository at this point in the history
  • Loading branch information
inknos committed Feb 28, 2024
1 parent b24e06b commit 1108192
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Example Usage:
# $ podman build --build-arg TYPE=distro -t ci-dnf-stack -f Dockerfile
# $ podman run --net none -it ci-dnf-stack behave dnf
#
# Build for DNF4
# $ podman build --build-arg DNF=dnf -t ci-dnf-stack -f Dockerfile
#
# Build for a specific Fedora version
# $ podman build --build-arg BASE=fedora:38 -t ci-dnf-stack -f Dockerfile

ARG BASE=fedora:39
FROM $BASE

ENV LANG C.UTF-8
ARG TYPE=nightly
ARG DNF

# disable deltas and weak deps
RUN set -x && \
Expand All @@ -24,31 +31,33 @@ RUN set -x && \

# enable dnf5
RUN set -x && \
dnf -y copr enable rpmsoftwaremanagement/dnf-nightly; \
dnf -y install dnf5-plugins; \
# run upgrade before distro-sync in case there is a new version in dnf-nightly that has a new dependency
dnf5 -y upgrade; \
dnf5 -y distro-sync --repo copr:copr.fedorainfracloud.org:rpmsoftwaremanagement:dnf-nightly;
if [ $DNF == "dnf5" ]; then \
dnf -y copr enable rpmsoftwaremanagement/dnf-nightly; \
dnf -y install dnf5-plugins; \
# run upgrade before distro-sync in case there is a new version in dnf-nightly that has a new dependency
dnf5 -y upgrade; \
dnf5 -y distro-sync --repo copr:copr.fedorainfracloud.org:rpmsoftwaremanagement:dnf-nightly; \
fi

RUN set -x && \
if [ -n "$COPR" ] && [ -n "$COPR_RPMS" ]; then \
dnf5 -y copr enable $COPR; \
dnf5 -y install $COPR_RPMS; \
$DNF -y copr enable $COPR; \
$DNF -y install $COPR_RPMS; \
fi

# copy test suite
COPY ./dnf-behave-tests/ /opt/ci/dnf-behave-tests

# install test suite dependencies
RUN set -x && \
dnf5 -y builddep /opt/ci/dnf-behave-tests/requirements.spec && \
$DNF -y builddep /opt/ci/dnf-behave-tests/requirements.spec && \
pip3 install -r /opt/ci/dnf-behave-tests/requirements.txt

# install local RPMs if available
COPY ./rpms/ /opt/ci/rpms/
RUN rm /opt/ci/rpms/*-{devel,debuginfo,debugsource}*.rpm; \
if [ -n "$(find /opt/ci/rpms/ -maxdepth 1 -name '*.rpm' -print -quit)" ]; then \
dnf5 -y install /opt/ci/rpms/*.rpm --disableplugin=local; \
$DNF -y install /opt/ci/rpms/*.rpm --disableplugin=local; \
fi

# create directory for dbus daemon socket
Expand Down

0 comments on commit 1108192

Please sign in to comment.