FROM amazon/aws-eb-python:3.4.2-onbuild-3.5.1

RUN apt-get -y update && \
 apt-get install -y gcc && \
 apt-get install -y build-essential && \
 apt-get install -y sqlite && \
 apt-get install -y telnet && \
 apt-get install -y supervisor

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN useradd celery -s /bin/false
RUN usermod -a -G uwsgi celery
RUN mkdir /tmp/sqlite
RUN touch /tmp/sqlite/celerybroker.db
RUN chown -R celery:uwsgi /tmp/sqlite
RUN chmod u+w+x,g+w+x /tmp/sqlite/
RUN chmod u+w+x,g+w+x /tmp/sqlite/celerybroker.db
# TODO: put the database in a more deterministic place

RUN pip install newrelic
RUN chmod +x start.sh

ENTRYPOINT ./start.sh
EXPOSE 8080
