From 40ddc3ecd762a85eb5b3a5aa70240de4673aa0d1 Mon Sep 17 00:00:00 2001 From: maride Date: Tue, 29 Aug 2023 12:06:21 +0200 Subject: [PATCH] Use nginx container-specific init folder --- Dockerfile | 10 +--------- aux/bootstrap.sh | 13 ------------- aux/cron.sh | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 22 deletions(-) delete mode 100755 aux/bootstrap.sh create mode 100755 aux/cron.sh diff --git a/Dockerfile b/Dockerfile index 1d06d25..86ac240 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,4 @@ FROM nginx:mainline-alpine RUN apk add hugo git # Copy over auxiliary scripts -COPY aux /aux - -# Cron hook for pulling and building -RUN echo "10 * * * * /aux/pull-n-build.sh" >> /var/spool/cron/crontabs/root - -# bootstrap script, basically cron && build -# after that, the base-image-specific CMD will kick in, which is quite complex -ENTRYPOINT /aux/bootstrap.sh - +COPY aux/* /docker-entrypoint.d/ diff --git a/aux/bootstrap.sh b/aux/bootstrap.sh deleted file mode 100755 index a38f62c..0000000 --- a/aux/bootstrap.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# stop on error -set -e - -# start cron daemon (goes into background) -crond - -# pull and build freshly -/aux/pull-n-build.sh - -# run nginx -nginx -g "daemon off;" diff --git a/aux/cron.sh b/aux/cron.sh new file mode 100755 index 0000000..27bd55e --- /dev/null +++ b/aux/cron.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# stop on error +set -e + +if [ "$BUILDFREQ" == "" ]; then + # set default + BUILDFREQ=10 +fi + +# Run the pull script regularly +RUN echo "$BUILDFREQ * * * * /docker-entrypoint.d/pull-n-build.sh" >> /var/spool/cron/crontabs/root + +# start cron daemon (goes into background) +crond