Essay-Grader's picture
Added new file
296bce3
raw
history blame contribute delete
908 Bytes
FROM python:3.9-slim
WORKDIR /code
# Hugging Face Space requirements
ENV HF_HOME=/tmp/cache \
TRANSFORMERS_CACHE=/tmp/cache \
SENTENCE_TRANSFORMERS_HOME=/tmp/cache \
PATH="/home/appuser/.local/bin:${PATH}"
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
# Create cache directory and non-root user
RUN mkdir -p ${HF_HOME} && chmod 777 ${HF_HOME} && \
useradd -m appuser && chown -R appuser /code ${HF_HOME}
USER appuser
# Install Python dependencies
COPY --chown=appuser:appuser requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=appuser:appuser app.py .
# Hugging Face Space-specific CMD
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]