FROM rockylinux:latest

RUN dnf install -y \
        dnf-plugins-core \
        createrepo_c \
        nginx \
        cronie \
        git \
        jq \
        yq \
        openssh-clients \
    && dnf clean all

COPY sync.sh /usr/local/bin/sync.sh
COPY entrypoint.sh /entrypoint.sh
COPY nginx.conf /etc/nginx/conf.d/repo.conf
RUN chmod +x /usr/local/bin/sync.sh /entrypoint.sh \
    && rm -f /etc/nginx/conf.d/default.conf

VOLUME /data/repo
EXPOSE 80

ENTRYPOINT ["/entrypoint.sh"]