FROM ubuntu:22.04 # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ NODE_ENV=production # Install system dependencies RUN apt-get update && apt-get install -y \ python3.11 \ python3.11-venv \ python3-pip \ nodejs \ npm \ git \ curl \ && rm -rf /var/lib/apt/lists/* # Set Python 3.11 as default RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 && \ update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 WORKDIR /app # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy frontend COPY frontend ./frontend WORKDIR /app/frontend RUN npm install && npm run build # Copy backend WORKDIR /app COPY backend ./backend COPY backend/app.py . # Expose port (HF Spaces uses 7860) EXPOSE 7860 # Start the FastAPI server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]