diff --git a/Dockerfile b/Dockerfile index 78eca957d04d446b7527f5fd6b151bc1ff2938bf..9a0ac4ab75bc5dde4244abba20c8095263bb4594 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,6 +51,9 @@ RUN pip install --upgrade pip && \ # define the port number the container should expose EXPOSE 8000 +HEALTHCHECK --interval=10s --timeout=3s \ + CMD curl -s -o /dev/null -f http://localhost:8000/health || exit 1 + # upload folder VOLUME /opt/app/uploads diff --git a/routes.py b/routes.py index 1167e8151a37ca7052fbe70fe1bde0e85abc90c6..389deace51484cdc78ea0ab9eb44d398c3b5a1fa 100644 --- a/routes.py +++ b/routes.py @@ -73,7 +73,7 @@ def upload(language: str): return process_file() else: if form.email.data: - form.email.data = form.email.data[:-len(current_app.config["MAIL_DOMAIN"])] + form.email.data = form.email.data[: -len(current_app.config["MAIL_DOMAIN"])] if language != current_app.config["DEFAULT_LANGUAGE"]: form.email.label.text = current_app.config["LOCALISATIONS"]["email"]["label"][language] @@ -94,3 +94,8 @@ def set_language(language): abort(404) request.language = language + + +@current_app.route("/health") +def health(): + return "", 204