Spotter-VM/lxc-apps/sahana/image

57 lines
2.3 KiB
Plaintext
Raw Normal View History

2020-04-04 00:17:24 +02:00
IMAGE sahana_0.0.1-200403
FROM alpine3.11-python3.8_3.8.2-200403
2018-09-13 14:26:27 +02:00
2019-10-05 15:49:29 +02:00
RUN EOF
# Install runtime dependencies
2020-03-22 20:04:46 +01:00
apk --no-cache add geos nginx py3-dateutil py3-gdal py3-lxml py3-numpy py3-pillow py3-psycopg2 py3-requests py3-sgmllib3k uwsgi-python3
2018-09-13 14:26:27 +02:00
2019-10-05 15:49:29 +02:00
# Install build dependencies
2020-02-09 15:56:37 +01:00
apk --no-cache add --virtual .deps build-base freetype-dev git py3-numpy-dev py3-pip python3-dev ttf-dejavu
2019-10-05 15:49:29 +02:00
# Install web2py
git clone --recursive https://github.com/web2py/web2py.git /srv/web2py
2020-02-09 15:56:37 +01:00
git -C /srv/web2py checkout 59700b8
2019-10-05 15:49:29 +02:00
git -C /srv/web2py submodule update
# Symlink WSGI handler
ln -s handlers/wsgihandler.py /srv/web2py/wsgihandler.py
2019-10-05 15:49:29 +02:00
# 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/^Pillow/#Pillow/' /srv/web2py/applications/eden/optional_requirements.txt # We have 6.2.1, Sahana requires 6.2.2
sed -i 's/^ansible/#ansible/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup
sed -i 's/^boto/#boto/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup on AWS
sed -i 's/^PyRTF/#PyRTF/' /srv/web2py/applications/eden/optional_requirements.txt # Ceased to exist
sed -i 's/^PyYAML/#PyYAML/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup
2020-03-22 20:04:46 +01:00
sed -i 's/^openst/#openst/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup on OpenStack
2020-02-07 18:29:23 +01:00
pip3 install -r /srv/web2py/applications/eden/optional_requirements.txt
2020-02-10 08:16:24 +01:00
pip3 install translate-toolkit
2019-10-05 15:49:29 +02:00
# Copy fonts with Czech glyphs
cp /usr/share/fonts/ttf-dejavu/DejaVuSerif-Bold.ttf /srv/web2py/applications/eden/static/fonts/Helvetica-Bold.ttf
cp /usr/share/fonts/ttf-dejavu/DejaVuSerif.ttf /srv/web2py/applications/eden/static/fonts/Helvetica.ttf
EOF
2020-02-07 18:29:23 +01:00
COPY image.d
2019-10-05 15:49:29 +02:00
RUN EOF
# Create OS user
2020-03-22 19:50:18 +01:00
addgroup -S -g 8080 sahana
adduser -S -u 8080 -h /srv/web2py -s /bin/false -g sahana -G sahana sahana
2019-10-05 15:49:29 +02:00
chown -R sahana:sahana /srv/web2py
2020-02-09 15:56:37 +01:00
# Patch web2py for python 3.8
cd /srv/web2py
patch -p0 </tmp/python38.patch
2019-10-05 15:49:29 +02:00
# Cleanup
apk --no-cache del .deps
find /srv/web2py -name '.git*' -exec rm -rf {} +
rm -r /root/.cache
2020-02-09 15:56:37 +01:00
rm /tmp/python38.patch
2019-10-05 15:49:29 +02:00
EOF
2020-02-07 18:29:23 +01:00
2020-02-09 15:56:37 +01:00
CMD /bin/s6-svscan /etc/services.d