Spaces:
Paused
Paused
File size: 934 Bytes
3c78db6 | 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 | # 1. Use an official lightweight Python base image
FROM python:3.11-slim
# 2. Set the working directory inside the container
WORKDIR /app
# 3. Install system dependencies
# This is required by opencv-python-headless (a dependency of rembg)
RUN apt-get update && apt-get install -y \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
# 4. Copy requirements file first to leverage Docker layer caching
COPY requirements.txt .
# 5. Install Python dependencies
# --no-cache-dir keeps the image size smaller
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# 7. Copy your application code into the container
COPY main.py .
# 8. Expose the port your app runs on
# Hugging Face Spaces automatically uses port 7860
EXPOSE 7860
# 9. The command to run your FastAPI server
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |