From 26bf5c5f82c5691a2544797fcde8c10e3a663ba4 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Sun, 3 Feb 2019 12:46:12 -0600 Subject: [PATCH] Use tini as init for entrypoint script Signed-off-by: Robert Dailey --- Dockerfile | 4 ++-- scripts/entrypoint.sh | 15 ++------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 177e105..601c8ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine -RUN apk add --no-cache docker bash +RUN apk add --no-cache docker bash tini ENV NEXTCLOUD_EXEC_USER=www-data ENV NEXTCLOUD_CONTAINER_NAME= @@ -10,7 +10,7 @@ ENV NEXTCLOUD_CRON_MINUTE_INTERVAL=15 COPY scripts/*.sh / COPY scripts/cron-scripts /cron-scripts -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["tini", "--", "/entrypoint.sh"] HEALTHCHECK --timeout=5s \ CMD ["/healthcheck.sh"] diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 1fe592c..cc2d028 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -27,16 +27,5 @@ echo "$containerId" > /tmp/containerId echo "*/$NEXTCLOUD_CRON_MINUTE_INTERVAL * * * * /cron-tasks.sh $containerId" \ > /var/spool/cron/crontabs/root -# Watch for SIGTERM (someone stops the docker container) so we can tell crond to exit -_term() { - echo "Caught SIGTERM signal!" - kill -TERM "$child" 2>/dev/null -} - -trap _term SIGTERM - -exec crond -f -l 0 & -echo "Started crond" - -child=$! -wait "$child" +echo "Starting crond" +exec crond -f -l 0