| # SAAP - satware Autonomous Agent Platform | |
| # Hugging Face Spaces Docker Deployment | |
| FROM python:3.11-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install Node.js for frontend build | |
| RUN apt-get update && apt-get install -y \ | |
| nodejs \ | |
| npm \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy backend requirements first (caching) | |
| COPY backend/requirements.txt /app/backend/requirements.txt | |
| RUN pip install --no-cache-dir -r /app/backend/requirements.txt | |
| # Copy frontend and build | |
| COPY frontend /app/frontend | |
| WORKDIR /app/frontend | |
| RUN npm install && npm run build | |
| # Copy backend | |
| WORKDIR /app | |
| COPY backend /app/backend | |
| # Move built frontend to backend static directory | |
| RUN mkdir -p /app/backend/static && \ | |
| cp -r /app/frontend/dist/* /app/backend/static/ | |
| # Set environment variables | |
| ENV HOST=0.0.0.0 | |
| ENV PORT=7860 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV DATABASE_URL=sqlite:///./saap_hf.db | |
| # Expose port (HF Spaces uses 7860) | |
| EXPOSE 7860 | |
| # Start the application | |
| WORKDIR /app/backend | |
| CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |