DocuIntel-AI / Dockerfile
RAgnarok456's picture
Initial clean deploy for Hugging Face
f6c426e
# --- STAGE 1: Build the React Frontend ---
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
# Install dependencies
COPY frontend/package*.json ./
RUN npm install
# Build the app
COPY frontend/ ./
RUN npm run build
# --- STAGE 2: Build the Python Backend ---
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies (libgomp1 is vital for FAISS)
RUN apt-get update && apt-get install -y \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Create a Hugging Face compatible user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Install Python dependencies
COPY --chown=user backend/requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy the backend code
COPY --chown=user backend/ .
# COPY THE FRONTEND BUILD FROM STAGE 1
# This replaces your manual "copy-paste" step!
COPY --chown=user --from=frontend-builder /app/frontend/dist ./dist
# Hugging Face uses port 7860
EXPOSE 7860
# Run the app
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]