From 388dd622b1814c13727f29f9ce6287f82ac59704 Mon Sep 17 00:00:00 2001 From: deng Date: Thu, 26 Jun 2025 06:22:12 +0000 Subject: [PATCH] add health checking --- Dockerfile | 4 ++++ docker-compose.yml | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/Dockerfile b/Dockerfile index 2c3b3c7..2b237d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,10 @@ RUN pip install --no-cache-dir -r requirements.txt # Copy source copy COPY ./translator . +# Install tools +RUN apt update +RUN apt install -y curl + # Run app CMD streamlit run app.py --server.port=8501 --server.enableCORS=false --server.enableXsrfProtection=false diff --git a/docker-compose.yml b/docker-compose.yml index d89306f..9039430 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,3 +7,9 @@ services: environment: - OPENAI_API_KEY=${OPENAI_API_KEY} - GEMINI_API_KEY=${GEMINI_API_KEY} + healthcheck: + test: curl -f http://localhost:8501 || exit 1 + interval: 1m + timeout: 10s + retries: 3 + start_period: 30s