Spaces:
Running
Running
File size: 1,747 Bytes
d56c6ae | 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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# -----------------------------
# Base Image
# -----------------------------
FROM python:3.10
# -----------------------------
# Environment
# -----------------------------
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# -----------------------------
# System Dependencies
# -----------------------------
RUN apt-get update && apt-get install -y \
build-essential \
libgl1 \
poppler-utils \
curl \
&& rm -rf /var/lib/apt/lists/*
# -----------------------------
# Working Directory
# -----------------------------
WORKDIR /app
# -----------------------------
# Upgrade pip tools
# -----------------------------
RUN pip install --upgrade pip setuptools wheel
# -----------------------------
# Install PyTorch CPU FIRST
# -----------------------------
RUN pip install --no-cache-dir \
torch==2.1.2+cpu \
torchvision==0.16.2+cpu \
torchaudio==2.1.2+cpu \
--index-url https://download.pytorch.org/whl/cpu
# -----------------------------
# Copy requirements
# -----------------------------
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# -----------------------------
# Copy project files
# -----------------------------
COPY . .
# -----------------------------
# Runtime directories
# -----------------------------
RUN mkdir -p uploads/images
# -----------------------------
# Hugging Face PUBLIC PORT
# -----------------------------
EXPOSE 7860
# -----------------------------
# Start FastAPI (internal) + Streamlit (public)
# -----------------------------
CMD ["bash", "-c", "uvicorn src.main:app --host 0.0.0.0 --port 8000 & exec streamlit run frontend/app.py --server.port=7860 --server.address=0.0.0.0 --server.headless=true --server.enableXsrfProtection=false"]
|