FROM registry.yandex.net/ubuntu:bionic

MAINTAINER Artem Novikov <fanem@yandex-team.ru>

# python 3.8
RUN cat /etc/issue
RUN apt update && \
    apt install -y software-properties-common && \
    rm -rf /var/lib/apt/lists/*

RUN add-apt-repository ppa:deadsnakes/ppa && \
    apt update && \
    apt install -y python3.8 python3.8-distutils
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python3.8 get-pip.py

# cron hack
RUN apt install -y cron supervisor
RUN ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
ADD ./supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD ./crontab /cron
RUN sed -ri 's/^session\s+required\s+pam_loginuid.so$/#session required pam_loginuid.so/' /etc/pam.d/cron
RUN chmod 0644 /cron
RUN crontab /cron

# create log file
RUN mkdir /supervisord_log && touch /supervisord_log/testpalm.log /supervisord_log/tracker.log

COPY ./reqdir/ /reqdir/

RUN python3.8 -m pip --no-cache-dir install -r /reqdir/requirements.txt

COPY . ./

CMD ["sh", "/run.sh"]
