FROM quay.io/fedora/fedora:latest

RUN set -ex && \
    # Adjust system defaults
    sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf && \
    echo "Set disable_coredump false" >> /etc/sudo.conf && \
    # Install necessary packages
    dnf install -y dnf-plugins-core tini && \
    dnf copr enable -y @teemtee/stable && \
    dnf install -y tmt && \
    dnf autoremove -y && \
    dnf clean all && \
    # Prepare a directory for experimenting
    mkdir /tmt

# Use tini as init to properly handle signals and reap zombie processes
ENTRYPOINT ["/usr/bin/tini", "--"]

# Prepare files for experimenting
COPY .fmf /tmt/.fmf
COPY tests /tmt/tests
COPY plans/main.fmf /tmt/plans/main.fmf
COPY plans/features/core.fmf /tmt/plans/core.fmf

# Run all plans under the regular user by default
WORKDIR /tmt
CMD ["tmt", "run", "-av", "provision", "-h", "local"]
