Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ ENV RAM_SIZE="4G"
ENV CPU_CORES="2"
ENV DISK_SIZE="1T"

HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=3 \
CMD curl -LfSs http://localhost:80 >/dev/null || exit 1
HEALTHCHECK --interval=60s --start-period=45s --retries=2 CMD /run/check.sh

ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]
20 changes: 20 additions & 0 deletions src/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -Eeuo pipefail

: "${NETWORK:="Y"}"

[ -f "/run/shm/qemu.end" ] && echo "QEMU is shutting down.." && exit 1
[ ! -s "/run/shm/qemu.pid" ] && echo "QEMU is not running yet.." && exit 0
[[ "$NETWORK" == [Nn]* ]] && echo "Networking is disabled.." && exit 0

file="/run/shm/qemu.ip"
[ ! -s "$file" ] && echo "The container has not enabled networking yet..." && exit 1

ip=$(<"$file")

if ! curl -m 20 -ILfSs "http://$ip:80/" > /dev/null; then
echo "Failed to reach ZimaOS at port 80" && exit 1
fi

echo "Healthcheck OK"
exit 0
Loading