Add after prerun/init scripts

This commit is contained in:
Marko Bocevski 2020-09-20 00:45:46 +02:00
parent 4e0634fca7
commit d0f2d89bbf
8 changed files with 50 additions and 2 deletions

View File

@ -48,8 +48,8 @@ RUN pip install --no-index --find-links=/srv/app/ext_wheels ckanext-harvest && \
# Remove wheels # Remove wheels
RUN rm -rf /srv/app/ext_wheels RUN rm -rf /srv/app/ext_wheels
# Add harvest entrypoint script # Add harvest afterinit script
COPY ./scripts/00_harvest.sh ${APP_DIR}/docker-entrypoint.d/00_harvest.sh COPY ./afterinit.d/00_harvest.sh ${APP_DIR}/docker-afterinit.d/00_harvest.sh
# Switch to the ckan user # Switch to the ckan user
USER ckan USER ckan

View File

@ -167,6 +167,9 @@ COPY setup/app ${APP_DIR}
# Create entrypoint directory for children image scripts # Create entrypoint directory for children image scripts
ONBUILD RUN mkdir docker-entrypoint.d ONBUILD RUN mkdir docker-entrypoint.d
# Create afterinit directory for children image scripts
ONBUILD RUN mkdir docker-afterinit.d
EXPOSE 5000 EXPOSE 5000
HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1 HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1

View File

@ -18,6 +18,19 @@ UWSGI_OPTS="--socket /tmp/uwsgi.sock --uid 92 --gid 92 --http :5000 --master --e
# Run the prerun script to init CKAN and create the default admin user # Run the prerun script to init CKAN and create the default admin user
python prerun.py python prerun.py
# Run any after prerun/init scripts provided by images extending this one
if [[ -d "${APP_DIR}/docker-afterinit.d" ]]
then
for f in ${APP_DIR}/docker-afterinit.d/*; do
case "$f" in
*.sh) echo "$0: Running after prerun init file $f"; . "$f" ;;
*.py) echo "$0: Running after prerun init file $f"; python "$f"; echo ;;
*) echo "$0: Ignoring $f (not an sh or py file)" ;;
esac
echo
done
fi
# Check whether http basic auth password protection is enabled and enable basicauth routing on uwsgi respecfully # Check whether http basic auth password protection is enabled and enable basicauth routing on uwsgi respecfully
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then

View File

@ -161,6 +161,9 @@ COPY setup/app ${APP_DIR}
# Create entrypoint directory for children image scripts # Create entrypoint directory for children image scripts
ONBUILD RUN mkdir docker-entrypoint.d ONBUILD RUN mkdir docker-entrypoint.d
# Create afterinit directory for children image scripts
ONBUILD RUN mkdir docker-afterinit.d
EXPOSE 5000 EXPOSE 5000
HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1 HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1

View File

@ -18,6 +18,19 @@ UWSGI_OPTS="--socket /tmp/uwsgi.sock --uid 92 --gid 92 --http :5000 --master --e
# Run the prerun script to init CKAN and create the default admin user # Run the prerun script to init CKAN and create the default admin user
python prerun.py python prerun.py
# Run any after prerun/init scripts provided by images extending this one
if [[ -d "${APP_DIR}/docker-afterinit.d" ]]
then
for f in ${APP_DIR}/docker-afterinit.d/*; do
case "$f" in
*.sh) echo "$0: Running after prerun init file $f"; . "$f" ;;
*.py) echo "$0: Running after prerun init file $f"; python "$f"; echo ;;
*) echo "$0: Ignoring $f (not an sh or py file)" ;;
esac
echo
done
fi
# Check whether http basic auth password protection is enabled and enable basicauth routing on uwsgi respecfully # Check whether http basic auth password protection is enabled and enable basicauth routing on uwsgi respecfully
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then

View File

@ -176,6 +176,9 @@ COPY setup/app ${APP_DIR}
# Create entrypoint directory for children image scripts # Create entrypoint directory for children image scripts
ONBUILD RUN mkdir docker-entrypoint.d ONBUILD RUN mkdir docker-entrypoint.d
# Create afterinit directory for children image scripts
ONBUILD RUN mkdir docker-afterinit.d
EXPOSE 5000 EXPOSE 5000
HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1 HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1

View File

@ -18,6 +18,19 @@ UWSGI_OPTS="--socket /tmp/uwsgi.sock --uid ckan --gid ckan --http :5000 --master
# Run the prerun script to init CKAN and create the default admin user # Run the prerun script to init CKAN and create the default admin user
python prerun.py python prerun.py
# Run any after prerun/init scripts provided by images extending this one
if [[ -d "${APP_DIR}/docker-afterinit.d" ]]
then
for f in ${APP_DIR}/docker-afterinit.d/*; do
case "$f" in
*.sh) echo "$0: Running after prerun init file $f"; . "$f" ;;
*.py) echo "$0: Running after prerun init file $f"; python "$f"; echo ;;
*) echo "$0: Ignoring $f (not an sh or py file)" ;;
esac
echo
done
fi
# Check whether http basic auth password protection is enabled and enable basicauth routing on uwsgi respecfully # Check whether http basic auth password protection is enabled and enable basicauth routing on uwsgi respecfully
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then