From f1b94d9ac71e083b2d506dc4ff7aeba094bd333c Mon Sep 17 00:00:00 2001 From: Jp Date: Fri, 30 Jan 2026 22:48:50 +0800 Subject: [PATCH] chore(docker): remove container_name and network, add healthcheck - Remove explicit container_name to allow Docker Compose to generate unique names - Remove custom network configuration as default network is sufficient - Add curl installation and healthcheck to Dockerfile for better container monitoring --- calorie_tracker_app/Dockerfile | 7 +++++++ docker-compose.yml | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/calorie_tracker_app/Dockerfile b/calorie_tracker_app/Dockerfile index bcf727a..7177b7a 100644 --- a/calorie_tracker_app/Dockerfile +++ b/calorie_tracker_app/Dockerfile @@ -8,6 +8,9 @@ ENV PYTHONUNBUFFERED=1 ENV FLASK_APP=app.py # Install dependencies +# Install curl for healthcheck +RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* + COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt @@ -24,5 +27,9 @@ RUN sed -i 's/\r$//' entrypoint.sh && \ # Expose port (default 5000) EXPOSE 5000 +# Healthcheck +HEALTHCHECK --interval=30s --timeout=3s \ + CMD curl -f http://localhost:5000/ || exit 1 + # Use entrypoint script to init db, seed data, and start server ENTRYPOINT ["./entrypoint.sh"] diff --git a/docker-compose.yml b/docker-compose.yml index cadf714..48516c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,6 @@ services: calorie-tracker: build: ./calorie_tracker_app image: git.jpaleviado.site/kingjaypee12/calorie-tracker:latest - container_name: calorie-tracker restart: unless-stopped ports: - "5001:5000" @@ -15,9 +14,3 @@ services: - SECRET_KEY=change-this-secret-key-in-production - API_NINJAS_KEY=${API_NINJAS_KEY} - PORT=5000 - networks: - - casaos-net - -networks: - casaos-net: - driver: bridge