FROM registry.yandex.net/mail/mail-trusty-common:latest

ARG   installdir
ARG   deploydir
COPY  $installdir /
COPY  $deploydir /

RUN apt-get update \
    && apt install -y python3.6 python3-pip libpython3.6-dev libpq-dev yandex-passport-tvmknife \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# setup python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
RUN curl https://bootstrap.pypa.io/pip/3.6/get-pip.py | sudo -H python3.6

# install dep
RUN pip3 install setuptools wheel --upgrade
RUN pip3 install --ignore-installed yandex-pgmigrate
RUN pip3 install --ignore-installed -r /usr/share/collectors-ext/oauth_token_loader/requirements.txt

RUN   chmod 744 /usr/sbin/entrypoint.sh

CMD ["/usr/sbin/entrypoint.sh"]
