# Multi-stage build: frontend + FastAPI backend in one container FROM node:18-alpine AS build WORKDIR /app # Install dependencies COPY package*.json ./ RUN npm ci || npm install # Copy source COPY . . # Build static assets RUN npm run build FROM python:3.10-slim AS runtime WORKDIR /app ENV PYTHONUNBUFFERED=1 RUN apt-get update \ && apt-get install -y --no-install-recommends libgl1 libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* COPY backend/ ./backend/ COPY backend/requirements.txt ./backend/requirements.txt RUN pip install --no-cache-dir -r backend/requirements.txt COPY --from=build /app/dist ./dist ENV PORT=7860 EXPOSE 7860 CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]