Spaces:
Sleeping
Sleeping
Download Dockerfile from infoclassifier/InfoClassifier: direct link, hf CLI and curl.
- Browser
- Download file 3.06 kB
-
https://huggingface.co/spaces/infoclassifier/InfoClassifier/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/infoclassifier/InfoClassifier/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/infoclassifier/InfoClassifier/resolve/main/Dockerfile
3.06 kB
| # ============================================================================= | |
| # Dockerfile v1.2.0 | |
| # Multi-stage build — slim production image. | |
| # | |
| # Build: docker build -t info-integrity-env . | |
| # Run: docker run --env-file .env -p 7860:7860 info-integrity-env | |
| # | |
| # Evaluation path (no external services needed): | |
| # docker run --env-file .env info-integrity-env \ | |
| # python inference.py --benchmark --out /tmp/results.json | |
| # | |
| # Required .env keys for the API server: | |
| # HF_TOKEN (for inference.py) | |
| # MODEL_NAME=Qwen/Qwen2.5-72B-Instruct | |
| # API_BASE_URL=https://router.huggingface.co/v1 | |
| # | |
| # Optional (only needed for live data collection via /collect): | |
| # SERPAPI_KEY / NEWSAPI_KEY / BRAVE_SEARCH_KEY / GOOGLE_FACTCHECK_KEY | |
| # REDIS_URL=redis://redis:6379 | |
| # ============================================================================= | |
| # ---- Stage 1: builder ---- | |
| FROM python:3.11-slim AS builder | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # ---- Stage 2: runtime ---- | |
| FROM python:3.11-slim AS runtime | |
| WORKDIR /app | |
| # Copy installed packages from builder | |
| COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | |
| COPY --from=builder /usr/local/bin /usr/local/bin | |
| # Copy application source | |
| COPY models.py ./models.py | |
| COPY environment.py ./environment.py | |
| COPY reward.py ./reward.py | |
| COPY explainability.py ./explainability.py | |
| COPY data_collector.py ./data_collector.py | |
| COPY app.py ./app.py | |
| COPY server.py ./server.py | |
| COPY inference.py ./inference.py | |
| COPY reward_config.yaml ./reward_config.yaml | |
| COPY openenv.yaml ./openenv.yaml | |
| COPY README.md ./README.md | |
| # Copy optional config files if they exist | |
| COPY domain_reliability.yaml* ./ | |
| # Copy tasks package (graders + registry + deterministic scenario datasets) | |
| COPY tasks/ ./tasks/ | |
| # Non-root user for security | |
| RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app | |
| USER appuser | |
| # Environment defaults (override via --env-file or -e flags) | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| HOST=0.0.0.0 \ | |
| PORT=7860 \ | |
| LOG_LEVEL=info \ | |
| REDIS_URL=redis://localhost:6379 \ | |
| SESSION_TTL_SECONDS=3600 \ | |
| CACHE_TTL_SECONDS=86400 \ | |
| MAX_SOURCES_PER_CLAIM=8 \ | |
| REQUEST_TIMEOUT=10 \ | |
| BENCHMARK_SEED=42 \ | |
| MAX_STEPS=20 \ | |
| GRADIO_ANALYTICS_ENABLED=false \ | |
| PYTHONPATH=/app | |
| EXPOSE 7860 | |
| # Use Python's built-in urllib — no curl dependency needed in runtime | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health', timeout=8)" | |
| # Default: start the API server | |
| # Override for benchmark: docker run ... python inference.py --benchmark | |
| CMD ["python", "app.py"] | |