chore(docker): remove container_name and network, add healthcheck
Some checks failed
Build and Push Docker Image (Gitea) / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Docker Image (Gitea) / build-and-push (push) Has been cancelled
- 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
This commit is contained in:
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user