From d259292165a2b27440f53011b02d5d6ca5362425 Mon Sep 17 00:00:00 2001
From: MrMeeb <mrmeeb@noreply.git.mrmeeb.stream>
Date: Fri, 19 Apr 2024 17:08:31 +0000
Subject: [PATCH] Add healthcheck. Fixes #11

---
 Dockerfile          | 13 +------------
 root/healthcheck.sh |  7 +++++++
 2 files changed, 8 insertions(+), 12 deletions(-)
 create mode 100644 root/healthcheck.sh

diff --git a/Dockerfile b/Dockerfile
index dc6ab63..07039d3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -34,17 +34,6 @@ RUN echo "${DOCKER_PRUNE_INTERVAL} echo Pruning docker volumes && docker volume
 # Remove warning from supervisord about running as root
 RUN sed -i '/\[supervisord\]/a user=root' /etc/supervisord.conf
 
-# Add stdout/stderr logs for docker
-RUN sed -i '/\[program:dockerd\]/a stdout_logfile_maxbytes=0' /etc/supervisord.conf && \
-    sed -i '/\[program:dockerd\]/a stdout_logfile=/dev/fd/1' /etc/supervisord.conf && \
-    sed -i '/\[program:dockerd\]/a redirect_stderr=true' /etc/supervisord.conf
-
-# Add Cron to supervisord 
-RUN echo "" >> /etc/supervisord.conf && \
-    echo "[program:cron]" >> /etc/supervisord.conf && \
-    echo "command=/usr/sbin/crond -f" >> /etc/supervisord.conf && \
-    echo "stdout_logfile=/dev/fd/1"  >> /etc/supervisord.conf && \
-    echo "stdout_logfile_maxbytes=0" >> /etc/supervisord.conf && \
-    echo "redirect_stderr=true" >> /etc/supervisord.conf
+HEALTHCHECK --interval=30s --timeout=15s --start-period=30s --retries=3 CMD "/healthcheck.sh"
 
 ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
\ No newline at end of file
diff --git a/root/healthcheck.sh b/root/healthcheck.sh
new file mode 100644
index 0000000..8d8a4c9
--- /dev/null
+++ b/root/healthcheck.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# Check docker socket is running
+ls -l /run | grep docker.sock
+
+# Check act is running
+/usr/bin/supervisorctl status act_runner | grep RUNNING
\ No newline at end of file