File size: 850 Bytes
54784ce dd9c792 3d3265e 536d98c 3d3265e 54784ce 0bc891a | 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 | # Base image with Python + minimal setup
FROM python:3.10-slim
# Set working directory inside container
WORKDIR /code
# Copy only requirements first to install dependencies
COPY requirements.txt .
# Install system dependencies and Python packages
RUN apt-get update && apt-get install -y \
gcc \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --upgrade pip && pip install -r requirements.txt
RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache
ENV HF_HOME=/code/.cache
# Copy Code
COPY . /code
COPY ./models /code/models
RUN chmod -R 777 /code/models
# Expose port used by Hugging Face Spaces (default: 7860)
EXPOSE 7860
# Run FastAPI with Uvicorn on the correct port
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |