Download Dockerfile from FractalAI/Research: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/spaces/FractalAI/Research/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/FractalAI/Research/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/FractalAI/Research/resolve/main/Dockerfile
1.76 kB
| # --- Stage 1: Build React frontend --- | |
| FROM node:20-alpine AS frontend | |
| WORKDIR /app/frontend | |
| # Install dependencies | |
| COPY frontend/package*.json ./ | |
| COPY frontend/package-lock.json ./ | |
| RUN npm install --frozen-lockfile | |
| # Build frontend | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # --- Stage 2: Python backend (CPU only) --- | |
| FROM python:3.10-slim AS backend | |
| # Environment setup | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| HF_HOME=/app/.cache/huggingface | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git curl && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Create non-root user | |
| RUN useradd -m appuser | |
| # Create necessary directories and set permissions | |
| RUN mkdir -p /app/.cache/huggingface \ | |
| && mkdir -p /app/static \ | |
| && chown -R appuser:appuser /app | |
| # Switch to non-root user | |
| USER appuser | |
| WORKDIR /app | |
| # Upgrade pip and install Python dependencies | |
| COPY backend/requirements.txt /app/backend/requirements.txt | |
| RUN python3 -m pip install --upgrade pip && \ | |
| python3 -m pip install -r /app/backend/requirements.txt | |
| # Copy backend code | |
| COPY backend/ /app/backend/ | |
| # Copy frontend build to static directory | |
| COPY --from=frontend /app/frontend/dist/ /app/static/ | |
| # App-specific environment variables | |
| ENV STATIC_DIR=/app/static \ | |
| MODEL_ID=FractalAIResearch/Fathom-R1-14B \ | |
| PIPELINE_TASK=text-generation \ | |
| QUANTIZE=auto | |
| # Optional: Healthcheck endpoint | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ | |
| CMD curl -f http://localhost:8000/health || exit 1 | |
| EXPOSE 7860 | |
| ENTRYPOINT ["python3", "-m", "uvicorn", "app.main:app", "--app-dir", "/app/backend", "--host", "0.0.0.0", "--port", "7860"] |