FROM almalinux:10

# createrepo_c bringt auch modifyrepo_c mit.
# libappstream-glib liefert appstreamcli fuer die optionale Validierung.
RUN dnf -y install \
        createrepo_c \
        dnf-plugins-core \
        git \
        openssh-clients \
        python3 \
        python3-pyyaml \
        jq \
        cronie \
        appstream \
    && dnf clean all

# yq (Go-Variante) fuer das YAML-Parsing in sync.sh
ARG YQ_VERSION=v4.44.3
RUN curl -fsSL -o /usr/local/bin/yq \
      "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" \
    && chmod +x /usr/local/bin/yq

COPY sync.sh /usr/local/bin/sync.sh
COPY appstream-gen.py /usr/local/bin/appstream-gen.py
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/sync.sh \
             /usr/local/bin/appstream-gen.py \
             /usr/local/bin/entrypoint.sh

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]