Spaces:
Sleeping
Sleeping
File size: 822 Bytes
aa7ac47 554fb11 aa7ac47 |
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 |
# 1️⃣ Use a lightweight Python base image
FROM python:3.10-slim
# 2️⃣ Set working directory inside container
WORKDIR /app
# 3️⃣ Install system dependencies (required by transformers, torch, etc.)
RUN apt-get update && apt-get install -y \
git wget build-essential && \
rm -rf /var/lib/apt/lists/*
# 4️⃣ Copy dependency list
COPY requirements.txt /app/
# 5️⃣ Install dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# 6️⃣ Copy all backend code to container
COPY . /app
ENV TRANSFORMERS_CACHE=/app/.cache
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
# 8️⃣ Expose port 7860 (Hugging Face default) or 8000 for general use
EXPOSE 7860
# 9️⃣ Run the FastAPI app using Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|