FROM almalinux:10

# dnf-plugins-core -> "dnf download"
# createrepo_c     -> createrepo_c + modifyrepo_c
# rpm-sign         -> rpmsign/rpmkeys (verify upstream sigs, re-sign with our key)
# gnupg2           -> gpg (generates/holds the mirror's own signing key)
# python3-pyyaml   -> YAML parsing in sync_helpers.py
# git              -> pulling the sources.yaml from a git repo (optional)
# curl             -> fetching upstream gpgkeys
RUN dnf -y install \
        dnf-plugins-core \
        createrepo_c \
        rpm-sign \
        gnupg2 \
        python3-pyyaml \
        git \
        curl \
    && dnf clean all

WORKDIR /opt/rpm-mirror

COPY sync.sh sync_helpers.py /opt/rpm-mirror/
RUN chmod +x /opt/rpm-mirror/sync.sh

COPY docker/syncer/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# sync.sh needs root to write /etc/yum.repos.d/*.repo - default container
# user is root, don't change it.
ENTRYPOINT ["/entrypoint.sh"]
