Use tini as init for entrypoint script

Signed-off-by: Robert Dailey <rcdailey@gmail.com>
This commit is contained in:
Robert Dailey 2019-02-03 12:46:12 -06:00
parent e9b5772dae
commit 26bf5c5f82
No known key found for this signature in database
GPG key ID: 97751323F0627314
2 changed files with 4 additions and 15 deletions

View file

@ -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"]

View file

@ -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