Spaces:
Running on Zero

Cognigraph / Dockerfile
Manoj Kumar Thapa
Fix Hugging Face Docker permissions
da0ee08
Raw History Blame Contribute Delete
921 Bytes
# Stage 1: Build React Frontend
FROM node:18 AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ .
RUN npm run build
# Stage 2: Python Backend
FROM python:3.10-slim
# Install system dependencies (Tesseract, Poppler)
RUN apt-get update && apt-get install -y \
tesseract-ocr \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# Add a non-root user (Hugging Face requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy Backend requirements
COPY --chown=user backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy Backend Code
COPY --chown=user backend/ .
# Copy Frontend Build Result
COPY --chown=user --from=frontend-builder /app/frontend/dist ./frontend_static
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]