Interest_Predictions / Dockerfile
InduwaraR's picture
deploy ml model
523415f
Raw History Blame Contribute Delete
687 Bytes
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
FROM python:3.9-slim
# Create non-root user as recommended by Hugging Face
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy requirements first to leverage Docker caching
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application code
COPY --chown=user . /app
# Set environment variables
ENV MODEL_PATH=/app
ENV HF_HOME=/home/user/.cache/huggingface
# Expose the port for Hugging Face Spaces
EXPOSE 7860
# Run the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]