Spaces:
Sleeping
Sleeping
Download Dockerfile from Pro-aryan00/Smart-MCQ-Solver: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/Pro-aryan00/Smart-MCQ-Solver/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Pro-aryan00/Smart-MCQ-Solver/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Pro-aryan00/Smart-MCQ-Solver/resolve/main/Dockerfile
1.46 kB
| FROM python:3.10-slim | |
| # System-level deps. build-essential is only needed if a pip package needs | |
| # to compile from source — safe to keep, drop later if you want a smaller image. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # HF Spaces Docker containers run as a non-root user (uid 1000) by convention. | |
| # Skipping this causes permission errors when the app tries to write to | |
| # ~/.cache/huggingface at runtime. | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /home/user/app | |
| # Copy + install requirements first so Docker caches this layer separately | |
| # from your source code — code changes won't force a full pip reinstall. | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Now copy the rest of the app (src/, README.md, etc.) | |
| COPY --chown=user . . | |
| # Writable HF cache location + model source config | |
| # SECURITY: Do not hardcode HF_USERNAME or HF_TOKEN here | |
| # Pass them as environment variables at runtime | |
| ENV HF_HOME=/home/user/.cache/huggingface \ | |
| MODEL_SOURCE=hub | |
| # HF Spaces routes external traffic to port 7860 by default for Docker SDK | |
| EXPOSE 7860 | |
| # Use Streamlit config file for security settings | |
| CMD ["streamlit", "run", "src/app.py", "--server.headless=true", "--server.address=0.0.0.0", "--server.port=7860"] | |