# Rebuild v9: Fix model routing - Hy3 Preview (OpenRouter via openai/tencent/), cohere/north-mini-code, deepseek/deepseek-v4-flash OR route, gpt-oss-120b no double-prefix # Stage 1: Clone upstream + patch frontend ChatInput + build FROM node:20-alpine AS patcher RUN apk add --no-cache git python3 RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /source COPY patch_frontend.py /tmp/patch_frontend.py RUN echo "=== Running frontend patch ===" && python3 /tmp/patch_frontend.py WORKDIR /source/frontend RUN npm install && npm run build # Stage 2: Production FROM python:3.12-slim COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ RUN useradd -m -u 1000 user WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ git \ curl \ && rm -rf /var/lib/apt/lists/* COPY --from=patcher /source/pyproject.toml /source/uv.lock ./ RUN uv sync --no-dev --frozen COPY --from=patcher /source/agent ./agent/ COPY --from=patcher /source/backend ./backend/ COPY --from=patcher /source/configs ./configs/ COPY --from=patcher /source/frontend/dist ./static/ COPY patch_models.py /tmp/patch_models.py RUN echo "=== Running backend patch ===" && python3 /tmp/patch_models.py RUN mkdir -p /app/session_logs && \ chown -R user:user /app USER user ENV HOME=/home/user \ PYTHONUNBUFFERED=1 \ PYTHONPATH=/app \ PATH="/app/.venv/bin:$PATH" EXPOSE 7860 WORKDIR /app/backend CMD ["bash", "start.sh"]