Q1: deploy and monitor app

هذا الالتزام موجود في:
Ubuntu
2026-07-27 10:35:23 +00:00
التزام 7827c9aee2
8 ملفات معدلة مع 495 إضافات و0 حذوفات

20
Dockerfile Normal file
عرض الملف

@@ -0,0 +1,20 @@
FROM python:3.12-slim
WORKDIR /app
# Install dependencies first (layer caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app code
COPY app.py .
EXPOSE 5000
# Basic container-level health check (Docker/most platforms respect this)
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:5000/health')" || exit 1
# gunicorn for production-grade serving instead of Flask dev server
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "2", "app:app"]