Spaces:
Running
Running
File size: 1,877 Bytes
300132c a6cdaab e3310d6 aa15811 e3310d6 1eac1e9 e412b9c e3310d6 8d4088c a6cdaab 7ebd053 a6cdaab e3310d6 a6cdaab e3310d6 a6cdaab e3310d6 1a4d163 867a67d e3310d6 73d7d5f 300132c e3310d6 a6cdaab dc49b69 | 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 48 49 50 51 52 53 54 55 56 57 | # Restore + patch frontend + backend models + auto-continue V17 + auto-approve
FROM node:20-alpine AS frontend-builder
RUN apk add --no-cache git python3
RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /source
# Patch frontend: add OpenRouter models
COPY patch_frontend.py /tmp/patch_frontend.py
RUN python3 /tmp/patch_frontend.py
# Patch auto-continue V17
COPY patch_auto_continue_v17.py /tmp/patch_auto_continue_v17.py
RUN python3 /tmp/patch_auto_continue_v17.py
WORKDIR /source/frontend
RUN npm config set fetch-timeout 120000 && \
npm config set fetch-retries 3 && \
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 ca-certificates && rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /tmp/source && \
cp /tmp/source/pyproject.toml /tmp/source/uv.lock ./ && \
cp -r /tmp/source/agent ./agent && \
cp -r /tmp/source/backend ./backend && \
cp -r /tmp/source/configs ./configs && \
rm -rf /tmp/source
RUN uv sync --no-dev --frozen
COPY --from=frontend-builder /source/frontend/dist ./static/
COPY configs/frontend_agent_config.json ./configs/frontend_agent_config.json
# Patch backend: accept new model IDs
COPY patch_models.py /tmp/patch_models.py
RUN python /tmp/patch_models.py
# Patch backend: auto-continue detection + auto-approve
COPY patch_agent_backend.py /tmp/patch_agent_backend.py
RUN python /tmp/patch_agent_backend.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 ["sh", "start.sh"] |