docusense-ai / Dockerfile
Minendra Gangwar
Set WORKDIR to backend to simplify import paths
0c12264
Raw
History Blame Contribute Delete
998 Bytes
# Stage 1: Build the React Frontend
FROM node:22 AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Build the Python Backend
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Python requirements
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy the backend code
COPY backend/ ./backend/
# Copy the compiled frontend from Stage 1
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# Create the data directories so FAISS doesn't crash
RUN mkdir -p /app/backend/data/extracted_images /app/backend/data/vectorstore
# Hugging Face Spaces expose port 7860 by default
EXPOSE 7860
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
WORKDIR /app/backend