mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-04-05 12:35:35 -04:00
feat: replace python script with curl (#7192)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
77081d0482
commit
c91f8e23d7
@@ -119,6 +119,7 @@ ENV GIT_COMMIT_HASH=$COMMIT
|
|||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends -y \
|
&& apt-get install --no-install-recommends -y \
|
||||||
|
curl \
|
||||||
gosu \
|
gosu \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
libldap-common \
|
libldap-common \
|
||||||
@@ -141,7 +142,9 @@ ENV APP_PORT=9000
|
|||||||
|
|
||||||
EXPOSE ${APP_PORT}
|
EXPOSE ${APP_PORT}
|
||||||
|
|
||||||
HEALTHCHECK CMD python -m mealie.scripts.healthcheck || exit 1
|
COPY ./docker/healthcheck.sh $MEALIE_HOME/healthcheck.sh
|
||||||
|
RUN chmod +x $MEALIE_HOME/healthcheck.sh
|
||||||
|
HEALTHCHECK CMD $MEALIE_HOME/healthcheck.sh
|
||||||
|
|
||||||
ENV HOST 0.0.0.0
|
ENV HOST 0.0.0.0
|
||||||
|
|
||||||
|
|||||||
12
docker/healthcheck.sh
Executable file
12
docker/healthcheck.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PORT="${API_PORT:-9000}"
|
||||||
|
|
||||||
|
if [ -n "$TLS_CERTIFICATE_PATH" ] && [ -n "$TLS_PRIVATE_KEY_PATH" ]; then
|
||||||
|
PROTO="https"
|
||||||
|
else
|
||||||
|
PROTO="http"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -k: TLS certificate is likely not issued for 127.0.0.1, so don't verify
|
||||||
|
curl -fsk "${PROTO}://127.0.0.1:${PORT}/api/app/about" > /dev/null
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
port = os.getenv("API_PORT")
|
|
||||||
|
|
||||||
if port is None:
|
|
||||||
port = 9000
|
|
||||||
|
|
||||||
if all(os.getenv(x) for x in ["TLS_CERTIFICATE_PATH", "TLS_PRIVATE_KEY_PATH"]):
|
|
||||||
proto = "https"
|
|
||||||
else:
|
|
||||||
proto = "http"
|
|
||||||
|
|
||||||
url = f"{proto}://127.0.0.1:{port}/api/app/about"
|
|
||||||
|
|
||||||
# TLS certificate is likely not issued for 127.0.0.1 so don't verify
|
|
||||||
r = requests.get(url, verify=False)
|
|
||||||
|
|
||||||
if r.status_code == 200:
|
|
||||||
sys.exit(0)
|
|
||||||
else:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
Reference in New Issue
Block a user