FROM registry.yandex.net/ubuntu:bionic

MAINTAINER Mariya Podpirova <mariya-murm@yandex-team.ru>

ENV LC_ALL=C
ENV PYTHONIOENCODING utf8
ENV TZ Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update
RUN apt-get install -y python-pip python3-pip cron supervisor git nano python-statface-client tmux

RUN ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
ADD ./supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD /reqdir/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

COPY ./reqdir/ /reqdir/

RUN pip3 install --upgrade pip
RUN pip2 install --upgrade pip && cp /reqdir/pip /usr/bin/pip2
RUN cat /reqdir/requirements && pip2 install -r /reqdir/requirements && pip2 install -i https://pypi.yandex-team.ru/simple/ -r /reqdir/requirements_y-t --ignore-installed
RUN cat /reqdir/requirements3 && pip3 install -r /reqdir/requirements3 && pip3 install -i https://pypi.yandex-team.ru/simple/ -r /reqdir/requirements_y-t3 --ignore-installed
RUN pip3 install --index-url https://pypi.yandex-team.ru/simple --disable-pip-version-check --no-deps --force-reinstall --upgrade certifi-yandex

ARG CACHECLEAN
COPY ./LogParse/ /LogParse/
COPY ./set_secret/ /set_secret/
COPY ./SupportQueueMonitoring/ /SupportQueueMonitoring/
COPY ./TestCasesByFilter/ /TestCasesByFilter/
COPY ./TestPersQueuesScripts/ /TestPersQueuesScripts/
COPY ./TestPersStatReportsGenerator/ /TestPersStatReportsGenerator/
COPY ./LogsAlerts/ /LogsAlerts/
COPY ./mail-py/RegressionCron/ /mail-py/RegressionCron/
COPY ./ReleasesStat/ /ReleasesStat/
COPY ./StartrekStat/ /StartrekStat/
COPY ./ReleasesWorkflow/ /ReleasesWorkflow/
COPY ./AssessorsQueueManager/ /AssessorsQueueManager/
COPY ./mailBot/ /mailBot/
COPY ./TestpalmManager/ /TestpalmManager/
COPY ./experimentParser/ /experimentParser/
COPY ./internalQATasks/ /internalQATasks/
COPY ./reqdir/git-config /root/.ssh/config
COPY ./GetUids/ /GetUids/

CMD ["/usr/bin/supervisord", "--nodaemon", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
CMD [ "/usr/bin/python3", "/mailBot/mailSmokeBot.py" ]
