FROM ccr.ccs.tencentyun.com/gm-base/gm-alpine-ffmpeg:v1.1

MAINTAINER wph [wangpenghong@igengmei.com]

COPY ./requirements.txt /tmp

RUN apk add --no-cache --virtual .build-deps  \
                bzip2-dev \
                coreutils \
                dpkg-dev dpkg \
                expat-dev \
                findutils \
                gcc \
                gdbm-dev \
                libc-dev \
                libffi-dev \
                libnsl-dev \
                libressl-dev \
                libtirpc-dev \
                linux-headers \
                make \
                ncurses-dev \
                pax-utils \
                readline-dev \
                sqlite-dev \
                tcl-dev \
                tk \
                tk-dev \
                xz-dev \
                zlib-dev \
                # 业务相关依赖和安装工具
                linux-headers \
                python3-dev \
                librdkafka-dev \
                mariadb-client \
                mariadb-dev \
                git \
                openssh \
                \
                && apk add --no-cache jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
                # 取消ssh第一次链接的确认
                && echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config \
                && apk add --no-cache  mariadb-connector-c-dev libxml2-dev libxslt-dev librdkafka-dev \
                && pip install --no-cache-dir -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r /tmp/requirements.txt \
                && mkdir -p /tmp/video_convert \
                && mkdir -p /data/log/mentha/app

ENV GM_RPCD_DEPLOY_CONF_PATH "/srv/apps/mimas/deploy_prod.xml"

COPY . /srv/apps/mentha/

WORKDIR /srv/apps/mentha/

RUN cat requirements.txt | grep master > /tmp/gm-requirements.txt \
    && pip install --no-deps --upgrade -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r /tmp/gm-requirements.txt \
    && apk del .build-deps

CMD gunicorn gm_rpcd.wsgi:application -w 5 -k gevent -b 0.0.0.0:8000 --worker-tmp-dir /dev/shm

