# Copyright 2013 Thatcher Peskens
-# Copyright 2014-2015 Guillaume Pellerin
-# Copyright 2014-2015 Thomas Fillon
+# Copyright 2014, 2017 Guillaume Pellerin, Thomas Fillon
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
MAINTAINER Guillaume Pellerin <yomguy@parisson.com>, Thomas fillon <thomas@parisson.com>
RUN mkdir -p /srv/src/
-RUN mkdir /srv/src/telemeta
+RUN mkdir -p /srv/app
+RUN mkdir -p /srv/src/telemeta
+
+RUN apt-get install -y --force-yes mysql-client
+
+ENV PYTHON_EGG_CACHE=/srv/.python-eggs
+RUN mkdir -p $PYTHON_EGG_CACHE
+RUN chown www-data:www-data $PYTHON_EGG_CACHE
+
COPY . /srv/src/telemeta
WORKDIR /srv/src/telemeta
-RUN conda install lxml
+
RUN pip install -r requirements.txt
RUN pip install -r requirements-dev.txt --src /srv/src
-ENV PYTHON_EGG_CACHE=/srv/.python-eggs
-RUN mkdir -p $PYTHON_EGG_CACHE
-RUN chown www-data:www-data $PYTHON_EGG_CACHE
+# Install Timeside and plugins from ./lib
+COPY ./app/scripts/setup_plugins.sh /srv/app/scripts/setup_plugins.sh
+COPY ./lib/ /srv/src/plugins/
+RUN /bin/bash /srv/app/scripts/setup_plugins.sh
WORKDIR /srv/app
EXPOSE 8000
--- /dev/null
+#!/bin/bash
+
+plugins=/srv/src/plugins
+
+apt-get update
+
+for dir in $(ls $plugins); do
+ env=$plugins/$dir/conda-environment.yml
+ if [ -f $env ]; then
+ conda env update --name root --file $env
+ fi
+ req=$plugins/$dir/debian-requirements.txt
+ if [ -f $req ]; then
+ packs=$(egrep -v "^\s*(#|$)" $req)
+ apt-get install -y --force-yes $packs
+ fi
+ if [ -f $plugins/$dir/setup.py ]; then
+ pip install -e $plugins/$dir/.
+ fi
+done
+
+apt-get clean