Spaces:
Runtime error
Runtime error
Download Dockerfile from rabieifical/math-engine: direct link, hf CLI and curl.
- Browser
- Download file 2.2 kB
-
https://huggingface.co/spaces/rabieifical/math-engine/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/rabieifical/math-engine/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/rabieifical/math-engine/resolve/main/Dockerfile
2.2 kB
| # ============================================================ | |
| # Math Search Engine โ Hugging Face Spaces (Gradio SDK) | |
| # | |
| # This runs as a Python app. The React frontend is pre-built | |
| # and served as static files from FastAPI. | |
| # ============================================================ | |
| FROM python:3.11-slim | |
| # Install Node.js for building React frontend | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends curl && \ | |
| curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | |
| apt-get install -y --no-install-recommends nodejs && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Create non-root user (required by HF Spaces) | |
| RUN useradd -m -u 1000 appuser | |
| WORKDIR /app | |
| # โโ Python backend dependencies โโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| COPY Backend/requirements.txt /app/Backend/requirements.txt | |
| RUN pip install --no-cache-dir -r /app/Backend/requirements.txt | |
| # Download NLTK data | |
| RUN python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab'); nltk.download('wordnet'); nltk.download('stopwords'); nltk.download('omw-1.4')" | |
| # โโ Build React frontend โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| COPY Frontend/package.json Frontend/package-lock.json /app/Frontend/ | |
| RUN cd /app/Frontend && npm ci | |
| COPY Frontend/ /app/Frontend/ | |
| RUN cd /app/Frontend && npm run build | |
| # Clean up node_modules to save image size (~200 MB) | |
| RUN rm -rf /app/Frontend/node_modules | |
| # โโ Copy backend source โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| COPY Backend/ /app/Backend/ | |
| # โโ Copy datasets โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| COPY Documents/ /app/Documents/ | |
| # โโ Copy entry point โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| COPY app.py /app/app.py | |
| # Give appuser ownership | |
| RUN chown -R appuser:appuser /app | |
| USER appuser | |
| # HF Spaces expects port 7860 | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |