FROM registry.yandex.net/ubuntu:xenial
MAINTAINER Anton Grigoryev <griganton@yandex-team.ru>

ENV WORKDIR /updater
ENV DJANGO_SETTINGS_MODULE updater.settings
ENV PIP_DEFAULT_TIMEOUT 120

WORKDIR $WORKDIR

COPY deploy/yandex-unstable.list /etc/apt/sources.list.d/yandex-unstable.list
RUN apt-get update
RUN apt-get install -y --allow-downgrades --allow-change-held-packages \
    libssl-dev \
    libcrypto++-dev \
    python-dev \
    libmysqlclient-dev \
    redis-server \
    python-pip

RUN pip install --upgrade pip
RUN pip install setuptools
RUN pip install supervisor

COPY src/requirements.txt requirements.txt
RUN pip install -r requirements.txt -i https://pypi.yandex-team.ru/simple/

COPY deploy/redis.conf /etc/redis.conf
COPY deploy/supervisord.conf /etc/supervisord.conf
COPY deploy/localization.cfg /etc/localization.cfg

COPY localization localization
COPY src .

# run tests
RUN YENV_TYPE=testing python setup.py test 2>&1

CMD ["/usr/local/bin/supervisord"]
