File size: 990 Bytes
928b74f 58f660b 928b74f 58f660b 928b74f | 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 35 36 37 38 39 40 41 | # Use Python 3.9 as base image
FROM python:3.9-slim
# Create a non-root user (Hugging Face best practice)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Install system dependencies (must be done as root)
USER root
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
git \
git-lfs \
&& rm -rf /var/lib/apt/lists/*
USER user
# Copy requirements and install
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the entire project with proper ownership
COPY --chown=user:user . .
# Create outputs directory and set permissions
RUN mkdir -p outputs && chmod 777 outputs
# Expose the standard Hugging Face port
EXPOSE 7860
# Command to run the application
# Points to your real backend in backend/app.py
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]
|