From 073dfd68a857a319293d0444b8a62154edf6db66 Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Fri, 2 Jun 2017 15:19:48 +0200 Subject: [PATCH] Manage timeside and timeside-plugins install from lib/ directory --- Dockerfile | 22 +++++++++++++++------- app/scripts/install_plugins.sh | 9 +++++++++ app/scripts/setup_plugins.sh | 22 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 app/scripts/install_plugins.sh create mode 100644 app/scripts/setup_plugins.sh diff --git a/Dockerfile b/Dockerfile index c23a4bbb..38ff4935 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 , Thomas fillon 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 index 00000000..ddd5d0cc --- /dev/null +++ b/app/scripts/install_plugins.sh @@ -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 index 00000000..2d9b3c50 --- /dev/null +++ b/app/scripts/setup_plugins.sh @@ -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 -- 2.39.5