PvRecNet / Dockerfile
desinez's picture
Fix Dockerfile
f1e8c75
Raw History Blame Contribute Delete
1.13 kB
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"]