saap-deploy / huggingface /Dockerfile
Hwandji's picture
fix: Simplify HF Dockerfile - remove nginx/supervisor, FastAPI only
f5791df
# SAAP - Simple Hugging Face Deployment
# FastAPI serves both backend API and frontend static files
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
# Copy frontend files
COPY frontend/package*.json ./
RUN npm ci --only=production
COPY frontend/ ./
RUN npm run build
# ============================================
# Python Backend + Serve Frontend
# ============================================
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy backend
COPY backend/ ./backend/
COPY requirements.txt ./
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy built frontend from builder
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# Environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# Expose port
EXPOSE 7860
# Start FastAPI (serves both API and frontend)
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]