Noumankhan2005's picture
Configure project for Hugging Face Docker deployment
3973c7a
# Stage 1: Build Next.js frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app/client
COPY client/package*.json ./
# Use --legacy-peer-deps if there are dependency conflicts
RUN npm install --legacy-peer-deps
COPY client/ ./
# Set build-time env var for API URL to empty string so it uses relative paths
ENV NEXT_PUBLIC_API_URL=""
RUN npm run build
# Stage 2: Python backend
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy backend requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code and data
COPY api/ ./api/
COPY agents/ ./agents/
COPY core/ ./core/
COPY data/ ./data/
# Copy built frontend from Stage 1
COPY --from=frontend-builder /app/client/out ./client/out
# Create directories for data persistence
RUN mkdir -p data/patient_images data/chroma_db
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Run the application
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"]