Skip to content

Commit 39d3991

Browse files
committed
Added file-based HEALTHCHECK
1 parent 3011a87 commit 39d3991

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@ RUN mkdir /backup && \
4141

4242
VOLUME ["/backup"]
4343

44-
CMD dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh
44+
HEALTHCHECK --interval=2s --retries=1800 \
45+
CMD stat /HEALTLY.status || exit 1
46+
47+
ENTRYPOINT dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh

run.sh

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ elif [ -n "${INIT_RESTORE_LATEST}" ]; then
1414
find /backup -maxdepth 1 -name '*.sql.gz' | tail -1 | xargs /restore.sh
1515
fi
1616

17+
touch /HEALTLY.status
18+
1719
echo "${CRON_TIME} /backup.sh >> /mysql_backup.log 2>&1" > /tmp/crontab.conf
1820
crontab /tmp/crontab.conf
1921
echo "=> Running cron task manager in foreground"

0 commit comments

Comments
 (0)