manitejeswar/project-webagent
1
1# Build Trigger: 2026-04-01-v122# --- Stage 1: Build Frontend ---3FROM node:18-alpine AS frontend-builder4ARG CACHE_BUST=125WORKDIR /app/frontend6COPY frontend/package.json frontend/package-lock.json* ./7RUN npm install8COPY frontend/ ./9# This generates the 'out' directory10RUN npm run build 11 12# --- Stage 2: Backend & Runtime ---13FROM python:3.11-slim14 15# Install system dependencies16RUN apt-get update && apt-get install -y \17 curl \18 gnupg \19 && rm -rf /var/lib/apt/lists/*20 21# Create a non-root user for Hugging Face22RUN useradd -m -u 1000 user23USER user24ENV HOME=/home/user \25 PATH=/home/user/.local/bin:$PATH \26 PYTHONUNBUFFERED=1 \27 PORT=786028 29WORKDIR $HOME/app30 31# Copy backend requirements and install32COPY --chown=user:user backend/requirements.txt ./backend/requirements.txt33RUN pip install --no-cache-dir --user -r backend/requirements.txt34 35# Copy backend code36COPY --chown=user:user backend/ ./backend/37 38# Copy the static frontend build into the backend directory39# main.py is configured to serve this 'out' folder40COPY --from=frontend-builder --chown=user:user /app/frontend/out ./backend/out41 42# Expose port (Hugging Face default)43EXPOSE 786044 45# Start script46# We ONLY run the FastAPI backend. It serves the frontend files too.47CMD ["sh", "-c", "cd backend && uvicorn main:app --host 0.0.0.0 --port 7860"]48 