Commit fda6d0cb authored by Felix Delattre's avatar Felix Delattre

Initial commit

parents
FROM debian:buster-slim
# Install dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update --yes --fix-missing && apt-get upgrade --yes && \
apt-get install --yes --no-install-recommends \
apt-utils \
build-essential \
bash \
coreutils \
python-pip \
python-virtualenv \
python-dev \
python-setuptools
# Install pelican and dependencies
COPY files/start.sh /start.sh
COPY files/requirements.txt requirements.txt
RUN pip install wheel
RUN pip install -r requirements.txt
# Cleanup
RUN apt-get autoremove --yes $build_dependencies && apt-get autoremove --yes && \
apt-get clean --yes && rm -rf /var/lib/apt/* /var/cache/apt/* /root/.cache
EXPOSE 8000
WORKDIR /srv/pelican
VOLUME ["/srv/pelican"]
CMD /start.sh restart 8000
This diff is collapsed.
==============
docker-pelican
==============
This is a Docker container for `pelican <https://getpelican.com>`__.
Copyright and copyleft
----------------------
Copyright (C) 2020
* Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
See the `LICENSE <./LICENSE>`__ for the full license text.
BeautifulSoup
beautifulsoup4
blinker
docutils
feedgenerator
ghp-import
Jinja2
Markdown
markdown-include
markdown-attr-plus
MarkupSafe
pelican
pelican-alias
pillow
Pygments
pytz
six
Unidecode
wsgiref
#!/usr/bin/env bash
##
# This section should match your Makefile
##
PY=${PY:-python}
PELICAN=${PELICAN:-pelican}
PELICANOPTS=
BASEDIR=$(pwd)
INPUTDIR=$BASEDIR/content
OUTPUTDIR=$BASEDIR/output
CONFFILE=$BASEDIR/pelicanconf.py
###
# Don't change stuff below here unless you are sure
###
SRV_PID=$BASEDIR/srv.pid
PELICAN_PID=$BASEDIR/pelican.pid
function usage(){
echo "usage: $0 (stop) (start) (restart) [port]"
echo "This starts Pelican in debug and reload mode and then launches"
echo "an HTTP server to help site development. It doesn't read"
echo "your Pelican settings, so if you edit any paths in your Makefile"
echo "you will need to edit your settings as well."
exit 3
}
function alive() {
kill -0 $1 >/dev/null 2>&1
}
function shut_down(){
PID=$(cat $SRV_PID)
if [[ $? -eq 0 ]]; then
if alive $PID; then
echo "Stopping HTTP server"
kill $PID
else
echo "Stale PID, deleting"
fi
rm $SRV_PID
else
echo "HTTP server PIDFile not found"
fi
PID=$(cat $PELICAN_PID)
if [[ $? -eq 0 ]]; then
if alive $PID; then
echo "Killing Pelican"
kill $PID
else
echo "Stale PID, deleting"
fi
rm $PELICAN_PID
else
echo "Pelican PIDFile not found"
fi
}
function start_up(){
local port=$1
echo "Starting up Pelican and HTTP server"
shift
cd $BASEDIR;
$PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS &
pelican_pid=$!
echo $pelican_pid > $PELICAN_PID
if ! alive $pelican_pid ; then
echo "Pelican didn't start. Is the Pelican package installed?"
return 1
fi
cd $OUTPUTDIR;
$PY -m pelican.server $port
srv_pid=$!
echo $srv_pid > $SRV_PID
if ! alive $srv_pid ; then
echo "The HTTP server didn't start. Is there another service using port" $port "?"
return 1
fi
sleep 1
echo 'Exiting Pelican and HTTP server processes.'
}
###
# MAIN
###
[[ ($# -eq 0) || ($# -gt 2) ]] && usage
port=''
[[ $# -eq 2 ]] && port=$2
if [[ $1 == "stop" ]]; then
shut_down
elif [[ $1 == "restart" ]]; then
shut_down
start_up $port
elif [[ $1 == "start" ]]; then
if ! start_up $port; then
shut_down
fi
else
usage
fi
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