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

MAINTAINER wph [wangpenghong@igengmei.com]

COPY ./requirements/common.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 \
                python2-dev \
                librdkafka-dev \
                mariadb-client \
                mariadb-dev \
                git \
                openssh \
                \
                # 取消ssh第一次链接的确认
                && echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config \
                && apk add --no-cache  mariadb-connector-c-dev libxml2-dev libxslt-dev librdkafka-dev \
                && pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com --upgrade setuptools \
                && sed -i '/st_mysql_options options;/a unsigned int reconnect;' /usr/include/mysql/mysql.h \
                && pip install --no-cache-dir -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r /tmp/common.txt \
                && mkdir -p /tmp/video_convert \
                && mkdir -p /data/log/graces_es6/app

COPY . /srv/apps/graces-es6/

WORKDIR /srv/apps/graces-es6/

# requirements文件中指定安装master分支的依赖每次构建镜像都会重新安装
RUN cat requirements/common.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

