FROM almalinux:latest

RUN dnf install -y \
        dnf-plugins-core \
        createrepo_c \
        nginx \
        cronie \
        git \
        jq \
        openssh-clients \
        wget \
        gnupg2 \
        rpm-sign \
    && dnf clean all

RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq &&\
    chmod +x /usr/local/bin/yq

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"]