Spotter-VM/lxc-apps/gnuhealth/lxcfile

66 lines
2.6 KiB
Plaintext

IMAGE gnuhealth_3.4.1-190620
LAYER alpine3.9_3.9.4-190620
LAYER alpine3.9-python3.6_3.6.8-190620
LAYER alpine3.9-nodejs10_10.14.2-190620
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.4.1.tar.gz -O /tmp/gnuhealth.tgz
tar xzf /tmp/gnuhealth.tgz -C /srv
mv /srv/gnuhealth-3.4.1 /srv/install
# Hackfix python-barcode support (will work in 3.4.2 - see http://hg.savannah.gnu.org/hgweb/health/rev/61b7bc7b1a78)
sed -i 's/pybarcode/python-barcode/' /srv/install/gnuhealth-setup
# Clone Sao (Tryton web client) repository
git clone -b 4.6 --single-branch --depth 1 https://github.com/tryton/sao /srv/gnuhealth/sao
# Create OS user
addgroup -S -g 8080 gnuhealth
adduser -S -u 8080 -h /srv/gnuhealth -s /bin/bash -g gnuhealth -G gnuhealth gnuhealth
chown -R gnuhealth:gnuhealth /srv/gnuhealth
# Install GNU Health
cd /srv/install
sudo -u gnuhealth ./gnuhealth-setup install
# Create symlink for the current version of trytond
ln -s /srv/gnuhealth/gnuhealth/tryton/server/trytond-* /srv/gnuhealth/gnuhealth/tryton/server/trytond-current
# Hackfix extraneous pymongo requirement
sed -i '/pymongo/d' /srv/gnuhealth/gnuhealth/tryton/server/modules/health_federation/health_federation.py
# Hackfix template1 database lock
sed -i 's/template1/gnuhealth/g' /srv/gnuhealth/gnuhealth/tryton/server/trytond-current/trytond/backend/postgresql/database.py
# Install Sao (Tryton web client) dependencies
cd /srv/gnuhealth/sao
sudo -u gnuhealth npm install --production
sudo -u gnuhealth ./node_modules/grunt-cli/bin/grunt
# Download Demo database
wget http://health.gnu.org/downloads/postgres_dumps/gnuhealth-34-demo.sql.gz -O /srv/gnuhealth/gnuhealth_demo.sql.gz
# Cleanup
apk --no-cache del .deps
find /srv/gnuhealth -name '.git*' -exec rm -rf {} +
rm -rf /srv/install
rm -f /tmp/gnuhealth.tgz
EOF
ENV PATH /srv/gnuhealth/gnuhealth/tryton/server/trytond-current/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-current:/srv/gnuhealth/gnuhealth/tryton/server/config
USER 8080 8080
CMD trytond --verbose