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

RUN mkdir -p /ephemeral && rm -rf /var/log/yandex && ln -s /ephemeral /var/log/yandex

RUN echo "deb http://precise.dist.yandex.ru/yandex-precise/ stable/amd64/" >> /etc/apt/sources.list
RUN echo "deb http://precise.dist.yandex.ru/yandex-precise/ stable/all/" >> /etc/apt/sources.list
RUN echo "deb http://mirror.yandex.ru/ubuntu precise main restricted" >> /etc/apt/sources.list
RUN echo "deb http://mirror.yandex.ru/ubuntu precise universe" >> /etc/apt/sources.list
RUN echo "deb http://mirror.yandex.ru/ubuntu precise-updates main restricted" >> /etc/apt/sources.list

RUN apt-get update \
    #&& apt-get purge -y python-yamail \
    && apt-get autoremove -y \
    && mv /usr/sbin/regenerate-monrun-tasks /usr/sbin/regenerate-monrun-tasks.hide \
    && touch /etc/yandex/p2p_do_nothing \
    && apt-get -y --force-yes install \
        python-pip \
        #libipreg1=1.0-34  p2p-distribution=0.1-127 p2p-distribution-ipreg-layout-config=0.1-127 \
        perl=5.14.2-6ubuntu2.5 libperl5.14=5.14.2-6ubuntu2.5 perl-base=5.14.2-6ubuntu2.5 perl-modules=5.14.2-6ubuntu2.5 \
        libyandex-sanitize1=1.4.44 yandex-python-sanitize=1.4.44 \
        libtemplate-perl=2.22-0.1build2 libjson-xs-perl=2.320-1build1 libyandex-persistent-perl=2.0.2 \
        libyandex-config-perl=2.1.0 libsub-name-perl=0.05-1build2 libclass-accessor-perl=0.34-1 \
        libdbi-perl=1.616-1build2 libhtml-parser-perl=3.69-1build1 libhtml-form-perl=6.00-1 \
        libcrypt-ssleay-perl=0.57-2ubuntu1 liblwp-protocol-https-perl=6.02-2 libwww-perl=6.03-3 \
        libxml-parser-perl=2.41-1build1 libxml-sax-expat-perl=0.40-2 libxml-simple-perl=2.18-3 libmorpheus-perl=0.46 \
        libparams-validate-perl=0.97-1build2 liblist-moreutils-perl=0.33-1build1 libcommon-sense-perl=3.4-1 \
        liblinux-inotify2-perl=1:1.22-0.2build1 libdigest-sha1-perl \
        #yandex-init=3.5.10 \
        yandex-smailik-perl=1.0-44 \
        yandex-ycssjs=2.35 \
        nginx=1.12.2-1.yandex.18 lua-cjson yandex-dh-nginx \
        #yamail-maillists-front-monitor yamail-maillists-mongo config-monitoring-mail-base  yandex-juggler-conntrackissmall-check snaked\
        python-bson python-central python-cheetah python-configobj python-crypto python-ipaddr python-flup \
        python-egenix-mxtools python-egenix-mxdatetime python-dns python-lockfile python-netconfig python-psutil \
        python-psycopg2 python-pymongo python-sss python-support python-tz python-webpy python-yaml \
        zk-flock \
        yandex-jdk6 \
        mysql-common libmysqlclient18 libmysqlclient-dev \
        libdps1 \
        uwsgi-plugin-python uwsgi \
        yandex-dh-envconfs yandex-dh-clearvcs yandex-dh-djangoinit yandex-dh-djangosettings yandex-dh-environment \
        libxml2-utils \
        yandex-yuicompressor \
        yandex-tools-wf-static \
        xsltproc \
        gettext \
        libxscript=5.73.45-19 libxscript-python=5.73.45-19 xscript-utility=5.73.45-19 xscript-development=5.73.45-19 \
        xscript-standard=5.73.45-19 \
        #xscript-yandex=5.73-100 \
        libticket-parser-python \
        libticket-parser libticket-parser2 libticket-parser2-dev \
    && mv /usr/sbin/regenerate-monrun-tasks.hide /usr/sbin/regenerate-monrun-tasks \
    && apt-get clean \
    && pip install -U "pip<10" \
    && rm -rf /var/lib/apt/lists/* \
    && rm -rf /root/.cache/yandex-yuicompressor \
    && ln -sf /usr/lib/x86_64-linux-gnu/lua/ /usr/local/lib/lua

COPY fs /
