Spaces:
Sleeping
Sleeping
File size: 1,172 Bytes
7df2966 ddf4091 7df2966 0988381 3b117d0 7df2966 17cd011 05474c3 ddf4091 05474c3 3b117d0 17cd011 7df2966 8335de0 ddf4091 e9141f2 3b117d0 7df2966 3b117d0 7df2966 3b117d0 7df2966 17cd011 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # ShantiView - Multi-stage Docker build
# Stage 1: Build React frontend
FROM node:22-alpine AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/pnpm-lock.yaml* ./
RUN corepack enable && pnpm install --frozen-lockfile
COPY frontend/ .
RUN pnpm build
# Stage 2: Python backend
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Copy and install Python dependencies
COPY backend/pyproject.toml backend/uv.lock* ./
# Grab the uv binary from the official image
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Install Python dependencies
RUN uv sync --frozen --no-dev
# Create necessary directories
RUN mkdir -p ./uploads ./models
# Copy backend code
COPY backend/ .
# Copy model files (MLP model and scaler)
COPY models/ ./models/
# Copy frontend build
COPY --from=frontend-build /app/frontend/dist ./static
ENV PORT=7860
EXPOSE 7860
# Use PORT environment variable (defaults to 7860 for Hugging Face Space compatibility)
CMD ["sh", "-c", "uv run uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"] |