diff --git a/Dockerfile b/Dockerfile index c3a24986..2cca62c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,7 @@ RUN python setup.py bdist_wheel FROM build AS build-taxhub WORKDIR /build/ COPY /setup.py . +COPY --chmod=755 /docker_healthcheck.sh . COPY /requirements-common.in . COPY /requirements-dependencies.in . COPY /VERSION . @@ -91,6 +92,8 @@ ENV PYTHONPATH=/dist/config/ ENV TAXHUB_SETTINGS=config.py ENV TAXHUB_STATIC_FOLDER=/dist/static +COPY --chmod=755 /docker_healthcheck.sh . + EXPOSE 5000 -CMD ["gunicorn", "apptax.app:create_app()", "--bind=0.0.0.0:5000", "--access-logfile=-", "--error-logfile=-"] +CMD ["gunicorn", "apptax.app:create_app()", "--bind=0.0.0.0:5000", "--access-logfile=-", "--error-logfile=-", "--reload", "--reload-extra-file=config/config.py"] diff --git a/docker_healthcheck.sh b/docker_healthcheck.sh new file mode 100644 index 00000000..aece6e98 --- /dev/null +++ b/docker_healthcheck.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# docker healthcheck TH +url_test=http://localhost:5000${TAXHUB_APPLICATION_ROOT}/ +if [ ! -f /tmp/container_healthy ]; then + curl -f "${url_test}" || exit 1 + touch /tmp/container_healthy +fi \ No newline at end of file