Smart-MCQ-Solver / Dockerfile
Aryan-Prajapati004
Version 2.0 : Made some changes in the UI and other stuffs
40d8928
Raw
History Blame Contribute Delete
1.44 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 + your model source config
ENV HF_HOME=/home/user/.cache/huggingface \
MODEL_SOURCE=hub \
HF_USERNAME=Pro-aryan00
# HF Spaces routes external traffic to port 7860 by default for Docker SDK
EXPOSE 7860
CMD ["streamlit", "run", "src/app.py", \
"--server.port=7860", \
"--server.address=0.0.0.0", \
"--server.headless=true", \
"--server.enableCORS=false", \
"--server.enableXsrfProtection=false"]