From ecf114352453894d54c1cb1c0d257da46ed392f3 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 13 Sep 2018 13:12:46 +0200 Subject: [PATCH] LXCize GNU Health build --- gnuhealth/Dockerfile | 48 ---------------- gnuhealth/lxcfile | 56 +++++++++++++++++++ gnuhealth/{build.sh => setup.sh} | 0 gnuhealth/{ => setup}/createdb.sql | 0 gnuhealth/{ => setup}/etc/init.d/gnuhealth | 0 .../srv/gnuhealth/conf/trytond.conf | 0 6 files changed, 56 insertions(+), 48 deletions(-) delete mode 100644 gnuhealth/Dockerfile create mode 100644 gnuhealth/lxcfile rename gnuhealth/{build.sh => setup.sh} (100%) rename gnuhealth/{ => setup}/createdb.sql (100%) rename gnuhealth/{ => setup}/etc/init.d/gnuhealth (100%) rename gnuhealth/{ => setup}/srv/gnuhealth/conf/trytond.conf (100%) diff --git a/gnuhealth/Dockerfile b/gnuhealth/Dockerfile deleted file mode 100644 index d1472c5..0000000 --- a/gnuhealth/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -FROM python3 -LABEL maintainer="Disassembler " - -RUN \ - # Install NodeJS runtime - apk --no-cache add nodejs - -RUN \ - # Install runtime dependencies - apk --no-cache add bash coreutils libffi libjpeg-turbo libpq - -RUN \ - # Install build dependencies - apk --no-cache add --virtual .deps build-base git libffi-dev libjpeg-turbo-dev libxml2-dev libxslt-dev ncurses npm patch postgresql-dev python3-dev sudo \ - # Download GNU Health - && wget http://ftp.gnu.org/gnu/health/gnuhealth-3.2.10.tar.gz -O /tmp/gnuhealth.tgz \ - && tar xzf /tmp/gnuhealth.tgz -C /srv \ - && mv /srv/gnuhealth-3.2.10 /srv/gnuhealth \ - && rm -f /tmp/gnuhealth.tgz \ - # Clone Sao (Tryton web client) repository - && git clone -b 4.2 --single-branch --depth 1 https://github.com/tryton/sao /srv/gnuhealth/sao \ - # Create OS user - && addgroup -S -g 8008 gnuhealth \ - && adduser -S -u 8008 -h /srv/gnuhealth -s /bin/bash -g gnuhealth -G gnuhealth gnuhealth \ - && chown -R gnuhealth:gnuhealth /srv/gnuhealth \ - # Install GNU Health - && cd /srv/gnuhealth \ - && sudo -u gnuhealth ./gnuhealth-setup install \ - # Hackfix template1 database lock - && sed -i 's/template1/gnuhealth/g' /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15/trytond/backend/postgresql/database.py \ - # Install Sao (Tryton web client) dependencies - && cd /srv/gnuhealth/sao \ - && sudo -u gnuhealth npm install grunt grunt-cli grunt-contrib-concat grunt-contrib-jshint grunt-contrib-uglify grunt-contrib-less grunt-po2json \ - && sudo -u gnuhealth npm install --production \ - && sudo -u gnuhealth ./node_modules/.bin/grunt \ - # Cleanup - && apk --no-cache del .deps \ - && find /srv/gnuhealth -name '.git*' -exec rm -rf {} + \ - && rm -rf /usr/local/share/.cache - -VOLUME ["/srv/gnuhealth/gnuhealth/tryton/server/config"] -EXPOSE 8080 - -USER gnuhealth -ENV PATH=/srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15/bin:${PATH} \ - TRYTOND_CONFIG=/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf \ - PYTHONPATH=/srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15:/srv/gnuhealth/gnuhealth/tryton/server/config -CMD ["trytond", "--verbose"] diff --git a/gnuhealth/lxcfile b/gnuhealth/lxcfile new file mode 100644 index 0000000..bf42f1f --- /dev/null +++ b/gnuhealth/lxcfile @@ -0,0 +1,56 @@ +IMAGE gnuhealth +LAYER shared/alpine +LAYER shared/libxml +LAYER shared/python3 +LAYER shared/nodejs +LAYER gnuhealth/gnuhealth + +FIXLAYER /usr/bin/fix-apk + +RUN EOF + # Install runtime dependencies + apk --no-cache add bash coreutils libffi libjpeg-turbo libpq + + # Install build dependencies + apk --no-cache add --virtual .deps build-base git libffi-dev libjpeg-turbo-dev libxml2-dev libxslt-dev ncurses npm patch postgresql-dev python3-dev sudo + + # Download GNU Health + wget http://ftp.gnu.org/gnu/health/gnuhealth-3.2.10.tar.gz -O /tmp/gnuhealth.tgz + tar xzf /tmp/gnuhealth.tgz -C /srv + mv /srv/gnuhealth-3.2.10 /srv/gnuhealth + rm -f /tmp/gnuhealth.tgz + + # Clone Sao (Tryton web client) repository + git clone -b 4.2 --single-branch --depth 1 https://github.com/tryton/sao /srv/gnuhealth/sao + + # Create OS user + addgroup -S -g 8008 gnuhealth + adduser -S -u 8008 -h /srv/gnuhealth -s /bin/bash -g gnuhealth -G gnuhealth gnuhealth + chown -R gnuhealth:gnuhealth /srv/gnuhealth + + # Install GNU Health + cd /srv/gnuhealth + sudo -u gnuhealth ./gnuhealth-setup install + + # Hackfix template1 database lock + sed -i 's/template1/gnuhealth/g' /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15/trytond/backend/postgresql/database.py + + # Install Sao (Tryton web client) dependencies + cd /srv/gnuhealth/sao + sudo -u gnuhealth npm install grunt grunt-cli grunt-contrib-concat grunt-contrib-jshint grunt-contrib-uglify grunt-contrib-less grunt-po2json + sudo -u gnuhealth npm install --production + sudo -u gnuhealth ./node_modules/.bin/grunt + + # Cleanup + apk --no-cache del .deps + find /srv/gnuhealth -name '.git*' -exec rm -rf {} + + rm -rf /usr/local/share/.cache +EOF + +MOUNT /srv/gnuhealth/conf srv/gnuhealth/gnuhealth/tryton/server/config + +USER 8008 8008 +ENV PATH /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV TRYTOND_CONFIG /srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf +ENV PYTHONPATH /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15:/srv/gnuhealth/gnuhealth/tryton/server/config +CMD trytond --verbose diff --git a/gnuhealth/build.sh b/gnuhealth/setup.sh similarity index 100% rename from gnuhealth/build.sh rename to gnuhealth/setup.sh diff --git a/gnuhealth/createdb.sql b/gnuhealth/setup/createdb.sql similarity index 100% rename from gnuhealth/createdb.sql rename to gnuhealth/setup/createdb.sql diff --git a/gnuhealth/etc/init.d/gnuhealth b/gnuhealth/setup/etc/init.d/gnuhealth similarity index 100% rename from gnuhealth/etc/init.d/gnuhealth rename to gnuhealth/setup/etc/init.d/gnuhealth diff --git a/gnuhealth/srv/gnuhealth/conf/trytond.conf b/gnuhealth/setup/srv/gnuhealth/conf/trytond.conf similarity index 100% rename from gnuhealth/srv/gnuhealth/conf/trytond.conf rename to gnuhealth/setup/srv/gnuhealth/conf/trytond.conf