FROM ghcr.io/cgwalters/fedora-silverblue:38

# Install ZFS repository
RUN rpm-ostree install https://zfsonlinux.org/fedora/zfs-release-2-3$(rpm --eval "%{dist}").noarch.rpm && \
    # cleanup and verification stage
    rm -vrf /var /*.rpm && \
    ostree container commit

# Install ZFS build deps
RUN rpm-ostree install \
    kernel-devel kernel-devel-matched kernel-headers kernel-srpm-macros && \
    # cleanup and verification stage
    rm -vrf /var && \
    ostree container commit

# TODO: Remove the following line once this bug is fixed: https://github.com/coreos/rpm-ostree/issues/4201
RUN test -f /usr/bin/ld || ln -s /usr/bin/ld.bfd /usr/bin/ld

# Install zfs
RUN rpm-ostree install zfs && \
    dkms autoinstall -k $(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}') && \
    # cleanup and verification stage
    rm -vrf /var && \
    ostree container commit

# TODO: Remove the following line once this bug is fixed: https://github.com/coreos/rpm-ostree/issues/4201
RUN test -h /usr/bin/ld && rm -v /usr/bin/ld

# Install zrepl repository
COPY zrepl.asc /var/roothome/zrepl.asc
RUN rpm --import /var/roothome/zrepl.asc
COPY zrepl.repo /etc/yum.repos.d/zrepl.repo

RUN rpm-ostree install \
    borgbackup \
    certbot \
    distrobox \
    fuse-encfs \
    fuse-sshfs \
    hddtemp \
    htop \
    iotop \
    ipmitool \
    libvirt \
    lm_sensors \
    net-tools \
    netcat \
    nginx \
    nut \
    pv \
    python3-certbot-nginx \
    qemu-kvm \
    rclone \
    screen \
    smartmontools \
    stress-ng \
    telnet \
    vim \
    zrepl-v0.6.0-1.x86_64 \
    && ln -s netcat /usr/bin/nc \
    && rm -vrf /var && ostree container commit

