Merge pull request #4 from amercader/better-extra-scripts

Provide a better way to run extra scripts from children images
This commit is contained in:
Marko Bocevski 2018-08-23 17:56:10 +02:00 committed by GitHub
commit 26f80c9e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -103,6 +103,9 @@ RUN pip install -e /srv/app/src/ckan && \
# Remove wheels
RUN rm -rf /srv/app/wheels
# Create entrypoint directory for children image scripts
ONBUILD RUN mkdir /docker-entrypoint.d
EXPOSE 5000
HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1

View File

@ -2,13 +2,25 @@
# Run the prerun script to init CKAN and create the default admin user
python prerun.py
# Run any startup scripts provided by images extending this one
if [[ -d "/docker-entrypoint.d" ]]
then
for f in /docker-entrypoint.d/*; do
case "$f" in
*.sh) echo "$0: Running init file $f"; . "$f" ;;
*.py) echo "$0: Running init file $f"; python "$f"; echo ;;
*) echo "$0: Ignoring $f (not an sh or py file)" ;;
esac
echo
done
fi
# Set the common uwsgi options
UWSGI_OPTS="--socket /tmp/uwsgi.sock --uid 92 --gid 92 --http :5000 --master --enable-threads --paste config:/srv/app/production.ini --lazy-apps --gevent 2000 -p 2 -L"
# Check whether http basic auth password protection is enabled and enable basicauth routing on uwsgi respecfully
if [ $? -eq 0 ]
then
/bin/sh extra_scripts.sh
if [ "$PASSWORD_PROTECT" = true ]
then
if [ "$HTPASSWD_USER" ] || [ "$HTPASSWD_PASSWORD" ]