Pathora / Dockerfile
malavikapradeep2001's picture
Initial Space
bf5da6b
raw
history blame
1.27 kB
# -----------------------------
# 1️⃣ Build Frontend
# -----------------------------
FROM node:18-bullseye AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ .
RUN npm run build
# -----------------------------
# 2️⃣ Build Backend
# -----------------------------
FROM python:3.10-slim-bullseye
WORKDIR /app
# Install essential system libraries for OpenCV, YOLO, and Ultralytics
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libgomp1 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy backend source code
COPY backend/ .
# Copy built frontend into the right folder for FastAPI
# ✅ this must match your app.mount() path in app.py
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# Install Python dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt || pip install -r backend/requirements.txt || true
# Install runtime dependencies explicitly
RUN pip install --no-cache-dir fastapi uvicorn python-multipart ultralytics opencv-python-headless pillow numpy scikit-learn tensorflow keras
# Hugging Face Spaces expect port 7860
EXPOSE 7860
# Run FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]