File size: 1,130 Bytes
52f4f77 3150852 f1e8c75 3150852 52f4f77 03fa350 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | FROM python:3.10-slim
# Install system dependencies if your ML models require compiling (optional but safe)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user for Hugging Face security compliance
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:${PATH}"
# Force Python to look at the root directory for module imports
ENV PYTHONPATH="/code"
WORKDIR /code
# Copy and install requirements
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the entire project structure over
COPY --chown=user . .
# βββ ADD THIS LINE TO INSTALL YOUR LOCAL PACKAGE ββββββββββββββββββ
# This explicitly runs 'pip install' inside the folder containing your pyproject.toml
RUN pip install --no-cache-dir ./backend/PvDeepSetNet
# Expose the mandatory Hugging Face port
EXPOSE 7860
# Run Uvicorn pointing directly to your backend's main.py FastAPI instance
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
|