ARG version
ARG branch=master

FROM registrywgs.webgenesis.it/webgenesys/jixel/idrocapjixel:$version-$branch
ENV LANG en_US.UTF-8  
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN echo $branch
RUN echo $version

RUN mkdir /usr/local/ies-solutions

RUN mkdir /usr/local/ies-solutions/jixel-cron/
COPY ./jixel-cron.* /usr/local/ies-solutions/jixel-cron/

RUN mkdir /usr/local/ies-solutions/jixel-background-task-handler/
COPY ./jbth.* /usr/local/ies-solutions/jixel-background-task-handler/

RUN mkdir /usr/local/ies-solutions/jixel-general-purpose-rabbit-consumer/
COPY ./jgprc.* /usr/local/ies-solutions/jixel-general-purpose-rabbit-consumer/

WORKDIR /usr/local/ies-solutions/jixel-background-task-handler

RUN dnf -y install python3-pip python3-devel python3-pycurl
RUN dnf -y install crontabs cronie cronie-anacron

RUN pip3 install pika
RUN pip3 install rasterio
RUN pip3 install redis

COPY ./jixel-background-task-handler.sh /usr/local/bin/jixel-background-task-handler
COPY ./jixel-cron.sh /usr/local/bin/jixel-cron
COPY ./jixel-general-purpose-rabbit-consumer.sh /usr/local/bin/jixel-general-purpose-rabbit-consumer

RUN chmod 500 /usr/local/bin/jixel-background-task-handler
RUN chmod 500 /usr/local/bin/jixel-cron
RUN chmod 500 /usr/local/bin/jixel-general-purpose-rabbit-consumer

CMD ["jixel-background-task-handler"]
