FROM python:2.7
MAINTAINER Dorian Pula <dorian.pula@amber-penguin-software.ca>
RUN apt-get update -qq \
    && apt-get install -y -qq \
    python \
    python-dev \
    gcc \
    python-pip \
    python-setuptools \
    libffi-dev \
    libssl-dev \
    apt-transport-https \
    && curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
    && echo 'deb https://deb.nodesource.com/node_4.x jessie main' > /etc/apt/sources.list.d/nodesource.list \
    && apt-get update -qq \
    && apt-get install -y -qq nodejs \
    && npm install -g \
    browserify \
    coffee-script \
    less \
    grunt-cli \
    karma-cli \
    phantomjs-prebuilt
ADD . /rookeries
WORKDIR /rookeries
RUN pip install --quiet -r requirements-dev.txt \
    && pip install --quiet uwsgi \
    && npm install
    && chown www-data . -R
    && chgrp www-data . -R
USER www-data
CMD uwsgi --http :5000 --master --processes 4 --module 'rookeries:make_rookeries_app()'
EXPOSE 5000
