Skip to content

Commit 994dc60

Browse files
authored
Merge pull request #86 from netbootxyz/healthchecks
Add container healthchecks
2 parents 406fc31 + 5cb5107 commit 994dc60

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ EXPOSE 3000
6464

6565
COPY root/ /
6666

67-
# default command
67+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 CMD /healthcheck.sh
68+
6869
CMD ["sh","/start.sh"]

root/healthcheck.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Check TFTP (UDP 69)
4+
if ! nc -z -u -w2 127.0.0.1 69; then
5+
echo "TFTP check failed"
6+
exit 1
7+
fi
8+
9+
# Check HTTP (nginx)
10+
if ! curl -fs http://127.0.0.1:${NGINX_PORT:-80}/ > /dev/null; then
11+
echo "HTTP check failed"
12+
exit 1
13+
fi
14+
15+
# Check Web App
16+
if ! curl -fs http://127.0.0.1:${WEB_APP_PORT:-3000}/ > /dev/null; then
17+
echo "Web App check failed"
18+
exit 1
19+
fi
20+
21+
exit 0

0 commit comments

Comments
 (0)