File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,10 @@ LABEL org.opencontainers.image.authors="Joe Pitt <Joe.Pitt@joepitt.co.uk>" \
22
22
VOLUME [ "/etc/serles" ]
23
23
COPY configure.py /usr/local/sbin/configure.py
24
24
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
25
+ COPY healthcheck.py /usr/local/bin/healthcheck.py
25
26
COPY gunicorn_config.py /opt/serles/gunicorn_config.py
26
27
ENTRYPOINT [ "sh" , "/usr/local/bin/entrypoint.sh" ]
27
- HEALTHCHECK --timeout=3s CMD [ "curl " , "-f" , "http://localhost:8000/ " ]
28
+ HEALTHCHECK --timeout=3s CMD [ "/opt/serles/bin/python3 " , "/usr/local/bin/healthcheck.py " ]
28
29
RUN python3 -m venv /opt/serles &&\
29
30
. /opt/serles/bin/activate &&\
30
31
python3 -m pip install --quiet --no-cache-dir --upgrade pip setuptools &&\
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ """Check if serles-acme is up"""
4
+
5
+ from sys import exit as sys_exit
6
+
7
+ from requests import get
8
+
9
+ if not get ("http://127.0.0.1:8000/" , timeout = 3 ).ok :
10
+ # signal unhealthy to the Docker Engine
11
+ sys_exit (1 )
You can’t perform that action at this time.
0 commit comments