PCAgentinAI / Dockerfile
ITNovaML's picture
Fix: Radar Map
7543670
Raw
History Blame Contribute Delete
4.6 kB
# ══════════════════════════════════════════════════════════════════════
# PolicyBridge β€” HuggingFace Docker Space
# ══════════════════════════════════════════════════════════════════════
# Port : 7860 (HuggingFace requirement)
# DB : Clever Cloud MySQL via MYSQL_ADDON_* Secrets
# Models: .pkl files loaded from /app/models/ at runtime
# Workers: 1 β€” Clever Cloud free tier allows max 5 connections total
# ══════════════════════════════════════════════════════════════════════
FROM python:3.11-slim
# ── System dependencies ───────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
default-libmysqlclient-dev \
pkg-config \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ── Working directory ─────────────────────────────────────────────────
WORKDIR /app
# ── Install Python dependencies ───────────────────────────────────────
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# ── Copy application code ─────────────────────────────────────────────
COPY app.py .
COPY train_all_agents.py .
COPY agent1_ssn_kyc.py .
COPY agent2_property_risk.py .
COPY agent3_underwriting.py .
COPY agent4_pricing.py .
COPY agent5_issuance_orchestrator.py .
COPY agent6_audit.py .
COPY agent6_audit_integration.py .
COPY agent7_fnol_intake.py .
COPY agent8_coverage_verify.py .
COPY agent9_fraud_signal.py .
COPY agent10_severity.py .
COPY agent11_triage.py .
COPY agent12_riskradar.py .
# ── Copy frontend HTML apps ───────────────────────────────────────────
COPY pc_insurance_multiagent_v4.html .
COPY policybridge_app.html .
# ── Copy trained model files ──────────────────────────────────────────
COPY models/ ./models/
# ── Create Silver output directory ───────────────────────────────────
RUN mkdir -p silver/kyc_decisions \
silver/property_risk \
silver/uw_decisions \
silver/pricing \
silver/issued_policies
# ── Non-root user (HuggingFace security requirement) ──────────────────
RUN useradd -m -u 1000 appuser \
&& chown -R appuser:appuser /app
USER appuser
# ── Environment defaults ──────────────────────────────────────────────
ENV PORT=7860 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# ── Expose port ───────────────────────────────────────────────────────
EXPOSE 7860
# ── Health check ──────────────────────────────────────────────────────
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/status')" \
|| exit 1
# ── Launch via Gunicorn ───────────────────────────────────────────────
# 1 worker = max 2 DB connections (pool_size=1 + max_overflow=1)
# Clever Cloud free tier: 5 max connections β€” this leaves 3 free
CMD ["gunicorn", \
"--bind", "0.0.0.0:7860", \
"--workers", "1", \
"--timeout", "120", \
"--keep-alive", "5", \
"--log-level", "info", \
"--access-logfile", "-", \
"--error-logfile", "-", \
"app:app"]