From fc34a17fa9ebe160b8c5f5d6b8050ede5951c502 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 10 Dec 2024 16:29:22 -0800 Subject: [PATCH] ci: misc adjustments for python (#275) --- backend-py/Dockerfile | 5 +++-- docker-compose.yml | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend-py/Dockerfile b/backend-py/Dockerfile index 046239c7..5087d153 100644 --- a/backend-py/Dockerfile +++ b/backend-py/Dockerfile @@ -22,15 +22,16 @@ ENV PYTHONUNBUFFERED=1 \ # Packages RUN apt update && \ - apt install -y --no-install-recommends curl libpq-dev + apt install -y --no-install-recommends libpq-dev # Dependencies, config and app COPY --from=build /app/.venv /app/.venv COPY logger.conf ./ COPY ./src ./src +HEALTHCHECK --interval=300s --timeout=10s CMD timeout 10s sh -c 'true > http://localhost:${PORT} || exit 1' + # Start with non-privileged user -HEALTHCHECK --interval=300s --timeout=10s CMD curl -f http://localhost:${PORT} USER 1001 SHELL ["/bin/bash", "-c"] ENTRYPOINT uvicorn src.main:app --host 0.0.0.0 --port ${PORT} --workers 1 --server-header --date-header --limit-concurrency 1000 --log-config ./logger.conf diff --git a/docker-compose.yml b/docker-compose.yml index a9ff89f3..f3246a40 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -108,7 +108,8 @@ services: entrypoint: /application/start-local.sh volumes: ["./backend-py:/application", "/application/.venv"] healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3000"] + test: timeout 10s bash -c 'true > /dev/tcp/127.0.0.1/3000' + environment: <<: [*postgres-vars, *python-vars] ports: ["3003:3000"]