CodeEvaluator / Dockerfile
DhyandevP's picture
Upload 4 files
2fe5c93 verified
Raw History Blame Contribute Delete
759 Bytes
# Code Evaluator — Hugging Face Spaces
#
# Requirements:
# - Non-root user with UID 1000 (HF Spaces security policy)
# - Application must listen on port 7860
# - /home/user/.local/bin on PATH for pip-installed binaries
FROM python:3.11-slim
# Create the non-root user and /app in a single layer to minimise image size.
RUN useradd -m -u 1000 -s /bin/bash user \
&& mkdir -p /app \
&& chown user:user /app
WORKDIR /app
USER user
ENV PATH="/home/user/.local/bin:${PATH}"
# Copy deps first so Docker cache reuses this layer on source-only changes.
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=user . .
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]