Spaces:
Building
Building
# Start with Python base image | |
FROM python:3.9-slim | |
# Install system dependencies as root | |
USER root | |
# Install required system packages | |
RUN apt-get update && apt-get install -y \ | |
libtorrent-rasterbar-dev \ | |
build-essential \ | |
libssl-dev \ | |
libboost-system-dev \ | |
libmagic1 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create non-root user | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV PATH="/home/user/.local/bin:$PATH" | |
WORKDIR /app | |
# Install Python dependencies | |
COPY --chown=user requirements.txt . | |
RUN pip install --no-cache-dir --user --upgrade -r requirements.txt | |
# Copy application files | |
COPY --chown=user . . | |
# Add this after COPY . . | |
RUN mkdir -p /app/static && chown user:user /app/static | |
# Expose Hugging Face default port | |
EXPOSE 7860 | |
# Start the application | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |