Commit 559d33ea authored by Sam Burney's avatar Sam Burney
Browse files

Update Docker to use Flask-based app

parent 014288ec
......@@ -2,8 +2,7 @@ FROM lsiobase/alpine:3.9
LABEL maintainer 'Sam Burney <sam@burney.io>'
ENV GALDIR_LISTEN=0.0.0.0:6543 \
GALDIR_SITENAME=GalDir \
ENV GALDIR_SITENAME="GalDir Docker" \
GALDIR_ALBUMS=albums \
GALDIR_CACHE=cache \
GALDIR_IMAGES_PERPAGE=12
......
#!/usr/bin/with-contenv bash
# Handle GALDIR_LISTEN GALDIR_SITENAME GALDIR_ALBUMS GALDIR_CACHE GALDIR_IMAGES_PERPAGE env variables
cat /usr/local/share/galdir/config.ini \
| sed -E "s/(listen = ).*/\1${GALDIR_LISTEN}/" \
| sed -E "s/(galdir.sitename = ).*/\1${GALDIR_SITENAME}/" \
| sed -E "s/(galdir.dir_albums = ).*/\1${GALDIR_ALBUMS}/" \
| sed -E "s/(galdir.dir_cache = ).*/\1${GALDIR_CACHE}/" \
| sed -E "s/(galdir.images_perpage = ).*/\1${GALDIR_IMAGES_PERPAGE}/" \
> /usr/local/share/galdir/production.ini
\ No newline at end of file
config_file=/usr/local/share/galdir/galdir/config.py
# Initial config.py setup
echo "DEBUG=False" > $config_file
echo "SECRET_KEY=$(python3 -c 'import os; print(os.urandom(16))')" >> $config_file
# Handle all GALDIR_* environment variables
for var in ${!GALDIR_*} ; do
echo $var=\""${!var}"\" >> $config_file
done
#!/usr/bin/with-contenv bash
# If config file exists, start daemon
if [ -f /usr/local/share/galdir/production.ini ] ; then
echo "Starting GalDir Web Server"
echo "Starting GalDir Web Server"
exec \
pserve /usr/local/share/galdir/production.ini
else
echo /usr/local/share/galdir/production.ini config file is missing
fi
exit 1
exec \
waitress-serve --listen=0.0.0.0:6543 --call 'galdir:create_app'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment