]> git.parisson.com Git - telemeta.git/commitdiff
Manage timeside and timeside-plugins install from lib/ directory
authorThomas Fillon <thomas@parisson.com>
Fri, 2 Jun 2017 13:19:48 +0000 (15:19 +0200)
committerThomas Fillon <thomas@parisson.com>
Fri, 2 Jun 2017 13:28:40 +0000 (15:28 +0200)
Dockerfile
app/scripts/install_plugins.sh [new file with mode: 0644]
app/scripts/setup_plugins.sh [new file with mode: 0644]

index c23a4bbb1d3620a97d259e446be81f0139d6ba73..38ff4935382083ed1ad63337d582b69b491d5de8 100644 (file)
@@ -1,6 +1,5 @@
 # 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.
@@ -19,16 +18,25 @@ FROM parisson/timeside:latest
 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
diff --git a/app/scripts/install_plugins.sh b/app/scripts/install_plugins.sh
new file mode 100644 (file)
index 0000000..ddd5d0c
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+plugins=/srv/src/plugins
+
+for dir in $(ls $plugins); do
+    if [ -f $plugins/$dir/setup.py ]; then
+        pip install -e $plugins/$dir/.
+    fi
+done
diff --git a/app/scripts/setup_plugins.sh b/app/scripts/setup_plugins.sh
new file mode 100644 (file)
index 0000000..2d9b3c5
--- /dev/null
@@ -0,0 +1,22 @@
+#!/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