Skip to content
Snippets Groups Projects
Commit 2006f56d5f23 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:sparkles: add elements to help build an image with module static

parent 1f24b9bc5c62
No related branches found
No related tags found
No related merge requests found
FROM nginx:alpine
ARG REVISION=""
ARG VENDOR=""
ARG VERSION=""
ARG AUTHORS=""
ARG CREATED=""
ARG TITLE=""
LABEL org.opencontainers.image.revision=$REVISION
LABEL org.opencontainers.image.vendor=$VENDOR
LABEL org.opencontainers.image.version=$VERSION
LABEL org.opencontainers.image.authors=$AUTHORS
LABEL org.opencontainers.image.created=$CREATED
LABEL org.opencontainers.image.title=$TITLE
ADD static /usr/share/nginx/html
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
# TODO add a way to bypass the value, maybe with a key in the setup.cfg file # TODO add a way to bypass the value, maybe with a key in the setup.cfg file
here=$(dirname $0) here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD) project_home=$(cd $here && cd .. && echo $PWD)
static_dir=$project_home/static/
if type "python3" > /dev/null; if type "python3" > /dev/null;
then then
odoo_modules="$(python3 -B -c "import configparser ; c = configparser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print (c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules').split()) or '')")" odoo_modules="$(python3 -B -c "import configparser ; c = configparser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print (c.has_option('odoo_scripts', 'modules') and ' '.join(c.get('odoo_scripts', 'modules').split()) or '')")"
...@@ -25,4 +26,5 @@ ...@@ -25,4 +26,5 @@
python2 -B -c "import ConfigParser ; c = ConfigParser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print(','.join(c.get('odoo_scripts', 'module_list').split()))" > $project_home/odoo_modules_list python2 -B -c "import ConfigParser ; c = ConfigParser.SafeConfigParser() ; c.read('${project_home}/setup.cfg') ; print(','.join(c.get('odoo_scripts', 'module_list').split()))" > $project_home/odoo_modules_list
fi fi
mkdir -p $project_home/odoo_modules mkdir -p $project_home/odoo_modules
set -e
rsync --delete -C --exclude='.hg*' --exclude='.git*' --links --exclude='*.pyc' -r --times $(eval echo $odoo_modules) $project_home/odoo_modules rsync --delete -C --exclude='.hg*' --exclude='.git*' --links --exclude='*.pyc' -r --times $(eval echo $odoo_modules) $project_home/odoo_modules
...@@ -28,2 +30,4 @@ ...@@ -28,2 +30,4 @@
rsync --delete -C --exclude='.hg*' --exclude='.git*' --links --exclude='*.pyc' -r --times $(eval echo $odoo_modules) $project_home/odoo_modules rsync --delete -C --exclude='.hg*' --exclude='.git*' --links --exclude='*.pyc' -r --times $(eval echo $odoo_modules) $project_home/odoo_modules
# this only sync static from our modules
rsync --include='/*/static/***' --exclude='/*/*' -r --times --prune-empty-dirs $(eval echo $odoo_modules) $static_dir
fi fi
...@@ -29,3 +33,1 @@ ...@@ -29,3 +33,1 @@
fi fi
exit $?
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment