FROM alpine:3.3

RUN apk add \
               gcc musl-dev python-dev py-pip \
               mariadb-dev \
               postgresql-dev \
               sqlite \
        --update-cache && rm -rf /var/cache/apk/*

ENV DJANGO_VERSION 1.9.4

RUN pip install mysqlclient psycopg2 django=="$DJANGO_VERSION"

FROM alpine:3.3

ENV DJANGO_VERSION 1.9.4

RUN apk add --update-cache \
            bash py-pip \
            mariadb-libs libpq sqlite && \
    apk add --virtual=build-deps \
            gcc musl-dev python-dev \
            mariadb-dev postgresql-dev && \
    pip install mysqlclient \
                psycopg2 \
                django=="$DJANGO_VERSION" && \
    apk del build-deps && rm -rf /var/cache/apk/*

Use 'virtual' for adding dependencies required to build Python packages which are later removed.
Use 'virtual' for adding dependencies required to build Python packages which are later removed.
