LXCize Sahana build

This commit is contained in:
Disassembler 2018-09-13 14:26:27 +02:00
parent 523765188a
commit 79f170ff01
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
68 changed files with 67 additions and 52 deletions

View File

@ -1,52 +0,0 @@
FROM python2
LABEL maintainer="Disassembler <disassembler@dasm.cz>"
RUN \
# Add edge/testing repository
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >>/etc/apk/repositories \
# Install runtime dependencies
&& apk --no-cache add geos@edge nginx py-gdal@edge py2-dateutil py2-lxml py2-numpy py2-pillow py2-psycopg2 py2-requests uwsgi-python
RUN \
# Install build dependencies
apk --no-cache add --virtual .deps build-base git freetype-dev libpng-dev py-numpy-dev py2-pip python2-dev ttf-dejavu \
# Hackfix for python find_library('c') call
&& ln -s /lib/ld-musl-x86_64.so.1 /lib/libc.so.1 \
# Install web2py
&& git clone --recursive https://github.com/web2py/web2py.git /srv/web2py \
&& git -C /srv/web2py checkout 7035398 \
&& git -C /srv/web2py submodule update \
# Fix Web2py urllib import (https://github.com/web2py/pydal/commit/9d2290c)
&& sed -i 's/import traceback/import traceback\nimport urllib/' /srv/web2py/gluon/packages/dal/pydal/base.py \
# Symlink WSGI handler
&& ln -s /srv/web2py/handlers/wsgihandler.py /srv/web2py/wsgihandler.py \
# Install Sahana
&& git clone --depth 1 https://github.com/sahana/eden.git /srv/web2py/applications/eden \
# Install python dependencies, exclude old or unnecessary ones
&& sed -i 's/^ansible/#ansible/' /srv/web2py/applications/eden/optional_requirements.txt \
&& sed -i 's/^boto/#boto/' /srv/web2py/applications/eden/optional_requirements.txt \
&& sed -i 's/^PIL/#PIL/' /srv/web2py/applications/eden/optional_requirements.txt \
&& sed -i 's/^PyRTF/#PyRTF/' /srv/web2py/applications/eden/optional_requirements.txt \
&& sed -i 's/^PyYAML/#PyYAML/' /srv/web2py/applications/eden/optional_requirements.txt \
&& pip install -r /srv/web2py/applications/eden/optional_requirements.txt \
# Copy fonts with Czech glyphs
&& cp /usr/share/fonts/ttf-dejavu/DejaVuSerif-Bold.ttf /srv/web2py/applications/eden/static/fonts/DejaVuSerif-Bold.ttf \
&& cp /usr/share/fonts/ttf-dejavu/DejaVuSerif.ttf /srv/web2py/applications/eden/static/fonts/DejaVuSerif.ttf \
# Create OS user
&& addgroup -S -g 8001 sahana \
&& adduser -S -u 8001 -h /srv/web2py -s /bin/sh -g sahana -G sahana sahana \
&& chown -R sahana:sahana /srv/web2py \
# Cleanup
&& apk --no-cache del .deps \
&& find /srv/web2py -name '.git*' -exec rm -rf {} + \
&& rm -r /srv/web2py/applications/admin /srv/web2py/applications/examples /srv/web2py/applications/welcome \
&& rm -r /root/.cache
COPY docker/etc/ /etc/
COPY --chown=8001:8001 docker/srv/ /srv/
VOLUME ["/srv/web2py/applications/eden/models", "/srv/web2py/applications/eden/databases", "/srv/web2py/applications/eden/uploads"]
EXPOSE 8080
CMD ["s6-svscan", "/etc/services.d"]

67
sahana/lxcfile Normal file
View File

@ -0,0 +1,67 @@
IMAGE sahana
LAYER shared/alpine
LAYER shared/libxml
LAYER shared/python2
LAYER sahana/sahana
RUN EOF
# Add edge/testing repository
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >>/etc/apk/repositories
# Install runtime dependencies
apk --no-cache add geos@edge nginx py-gdal@edge py2-dateutil py2-lxml py2-numpy py2-pillow py2-psycopg2 py2-requests uwsgi-python
# Install build dependencies
apk --no-cache add --virtual .deps build-base git freetype-dev libpng-dev py-numpy-dev py2-pip python2-dev ttf-dejavu
# Hackfix for python find_library('c') call
ln -s /lib/ld-musl-x86_64.so.1 /lib/libc.so.1
# Install web2py
git clone --recursive https://github.com/web2py/web2py.git /srv/web2py
git -C /srv/web2py checkout 7035398
git -C /srv/web2py submodule update
# Fix Web2py urllib import (https://github.com/web2py/pydal/commit/9d2290c)
sed -i 's/import traceback/import traceback\nimport urllib/' /srv/web2py/gluon/packages/dal/pydal/base.py
# Symlink WSGI handler
ln -s /srv/web2py/handlers/wsgihandler.py /srv/web2py/wsgihandler.py
# Install Sahana
git clone --depth 1 https://github.com/sahana/eden.git /srv/web2py/applications/eden
# Install python dependencies, exclude old or unnecessary ones
sed -i 's/^ansible/#ansible/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^boto/#boto/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PIL/#PIL/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PyRTF/#PyRTF/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PyYAML/#PyYAML/' /srv/web2py/applications/eden/optional_requirements.txt
pip install -r /srv/web2py/applications/eden/optional_requirements.txt
# Copy fonts with Czech glyphs
cp /usr/share/fonts/ttf-dejavu/DejaVuSerif-Bold.ttf /srv/web2py/applications/eden/static/fonts/DejaVuSerif-Bold.ttf
cp /usr/share/fonts/ttf-dejavu/DejaVuSerif.ttf /srv/web2py/applications/eden/static/fonts/DejaVuSerif.ttf
EOF
COPY lxc
RUN EOF
# Create OS user
addgroup -S -g 8001 sahana
adduser -S -u 8001 -h /srv/web2py -s /bin/sh -g sahana -G sahana sahana
chown -R sahana:sahana /srv/web2py
# Cleanup
apk --no-cache del .deps
find /srv/web2py -name '.git*' -exec rm -rf {} +
rm -r /srv/web2py/applications/admin /srv/web2py/applications/examples /srv/web2py/applications/welcome
rm -r /root/.cache
EOF
MOUNT /srv/sahana/conf srv/web2py/applications/eden/models
MOUNT /srv/sahana/data/Spotter srv/web2py/applications/eden/modules/templates/Spotter
MOUNT /srv/sahana/data/databases srv/web2py/applications/eden/databases
MOUNT /srv/sahana/data/uploads srv/web2py/applications/eden/uploads
CMD /bin/s6-svscan /etc/services.d

View File

Can't render this file because it has a wrong number of fields in line 2.

View File

Can't render this file because it has a wrong number of fields in line 2.

View File

Can't render this file because it has a wrong number of fields in line 2.

View File

Can't render this file because it has a wrong number of fields in line 6.

View File

Can't render this file because it has a wrong number of fields in line 2.

View File

Can't render this file because it contains an unexpected character in line 2 and column 211.