FROM registry.yandex.net/maillists/ml-pydeps:1.0

COPY etc/logrotate.d/* /etc/logrotate.d/
COPY etc/nginx/nginx.conf /etc/nginx/
COPY etc/nginx/*conf /etc/nginx/
COPY etc/nginx/*format.conf /etc/nginx/conf.d/
COPY etc/nginx/sites-available/* /etc/nginx/sites-available/

COPY etc/xscript-offline.conf /etc/yandex/tools-maillists/
COPY htdocs /app/maillists/htdocs

COPY etc/yandex/machine.conf /etc/yandex/

COPY etc/supervisor/*.conf /etc/supervisor/maillists/

COPY etc/zk-flock/distributed-flock.*.json /etc/

COPY etc/monrun/conf.d/* /etc/monrun/

COPY docker/FS/ /
COPY src /app/

RUN cd /app/maillists/htdocs && make ycssjs
RUN cd /app/maillists && sed -i '/^#~/d' locale/*/LC_MESSAGES/*.po && django-admin.py compilemessages

RUN chmod a+x /docker-entrypoint* \
    && chmod 644 /etc/logrotate.d/* \
    && chmod 644 /etc/cron.d/* \
    && mkdir -p /var/run/juggler-client/ && chown monitor:root /var/run/juggler-client/ && chmod 775 /var/run/juggler-client/ \
    && usermod -a -G sudo monitor

RUN ln -fs /app/maillists/manage.py /usr/local/bin/manage.py
