Spaces:
Paused
Paused
ROOT FIX: Dockerfile patches agent.py models + llm_params at build time via sed
Browse files- Dockerfile +19 -13
Dockerfile
CHANGED
|
@@ -1,19 +1,17 @@
|
|
| 1 |
-
# CACHE_BUST=
|
| 2 |
-
# Clone and build from smolagents/ml-intern source
|
| 3 |
FROM node:20-alpine AS frontend-builder
|
| 4 |
RUN apk add --no-cache git
|
| 5 |
RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /source
|
| 6 |
WORKDIR /source/frontend
|
| 7 |
RUN npm install && npm run build
|
| 8 |
|
| 9 |
-
# Stage 2: Production
|
| 10 |
FROM python:3.12-slim
|
| 11 |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
| 12 |
RUN useradd -m -u 1000 user
|
| 13 |
WORKDIR /app
|
| 14 |
RUN apt-get update && apt-get install -y --no-install-recommends git curl && rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
-
# Clone source
|
| 17 |
RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /tmp/source && \
|
| 18 |
cp /tmp/source/pyproject.toml /tmp/source/uv.lock ./ && \
|
| 19 |
cp -r /tmp/source/agent ./agent && \
|
|
@@ -21,22 +19,30 @@ RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /tmp/
|
|
| 21 |
cp -r /tmp/source/configs ./configs && \
|
| 22 |
rm -rf /tmp/source
|
| 23 |
|
| 24 |
-
# Install
|
| 25 |
RUN uv sync --no-dev --frozen
|
| 26 |
|
| 27 |
-
# Copy
|
| 28 |
COPY --from=frontend-builder /source/frontend/dist ./static/
|
| 29 |
|
| 30 |
-
# ======
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
COPY backend/main.py ./backend/main.py
|
| 33 |
COPY configs/frontend_agent_config.json ./configs/frontend_agent_config.json
|
| 34 |
-
# Verify override was applied
|
| 35 |
-
RUN head -3 ./backend/main.py && echo "✅ Custom main.py applied"
|
| 36 |
-
RUN cat ./configs/frontend_agent_config.json && echo "✅ Custom config applied"
|
| 37 |
-
# ====== END OVERRIDE ======
|
| 38 |
|
| 39 |
-
# Create directories
|
| 40 |
RUN mkdir -p /app/session_logs && chown -R user:user /app
|
| 41 |
|
| 42 |
USER user
|
|
|
|
| 1 |
+
# CACHE_BUST=20260514_v5_ROOTFIX
|
|
|
|
| 2 |
FROM node:20-alpine AS frontend-builder
|
| 3 |
RUN apk add --no-cache git
|
| 4 |
RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /source
|
| 5 |
WORKDIR /source/frontend
|
| 6 |
RUN npm install && npm run build
|
| 7 |
|
|
|
|
| 8 |
FROM python:3.12-slim
|
| 9 |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
| 10 |
RUN useradd -m -u 1000 user
|
| 11 |
WORKDIR /app
|
| 12 |
RUN apt-get update && apt-get install -y --no-install-recommends git curl && rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Clone source
|
| 15 |
RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /tmp/source && \
|
| 16 |
cp /tmp/source/pyproject.toml /tmp/source/uv.lock ./ && \
|
| 17 |
cp -r /tmp/source/agent ./agent && \
|
|
|
|
| 19 |
cp -r /tmp/source/configs ./configs && \
|
| 20 |
rm -rf /tmp/source
|
| 21 |
|
| 22 |
+
# Install deps
|
| 23 |
RUN uv sync --no-dev --frozen
|
| 24 |
|
| 25 |
+
# Copy frontend
|
| 26 |
COPY --from=frontend-builder /source/frontend/dist ./static/
|
| 27 |
|
| 28 |
+
# ====== ROOT FIX: Patch models list directly in agent.py ======
|
| 29 |
+
RUN sed -i 's/DEFAULT_FREE_MODEL_ID = "moonshotai\/Kimi-K2.6"/DEFAULT_FREE_MODEL_ID = "deepseek\/deepseek-chat-v3-0324"/' ./backend/routes/agent.py && \
|
| 30 |
+
sed -i '/"id": "moonshotai\/Kimi-K2.6"/,/},/c\ {"id": "deepseek/deepseek-chat-v3-0324", "label": "DeepSeek V3", "provider": "openrouter", "tier": "free", "recommended": True},' ./backend/routes/agent.py && \
|
| 31 |
+
sed -i '/"id": _claude_picker_model_id()/,/},/c\ {"id": "google/gemini-2.0-flash-001", "label": "Gemini 2.0 Flash", "provider": "openrouter", "tier": "free", "recommended": True},' ./backend/routes/agent.py && \
|
| 32 |
+
sed -i '/"id": "openai\/gpt-5.5"/,/},/c\ {"id": "qwen/qwen3-30b-a3b", "label": "Qwen3 30B", "provider": "openrouter", "tier": "free"},' ./backend/routes/agent.py && \
|
| 33 |
+
sed -i '/"id": "MiniMaxAI\/MiniMax-M2.7"/,/},/c\ {"id": "anthropic/claude-sonnet-4", "label": "Claude Sonnet 4", "provider": "openrouter", "tier": "pro"},' ./backend/routes/agent.py && \
|
| 34 |
+
sed -i '/"id": "zai-org\/GLM-5.1"/,/},/c\' ./backend/routes/agent.py && \
|
| 35 |
+
sed -i '/"id": "deepseek-ai\/DeepSeek-V4-Pro:deepinfra"/,/},/c\' ./backend/routes/agent.py && \
|
| 36 |
+
echo "✅ Models list patched"
|
| 37 |
+
|
| 38 |
+
# Verify patch
|
| 39 |
+
RUN grep -A2 "DEFAULT_FREE_MODEL_ID" ./backend/routes/agent.py | head -3
|
| 40 |
+
RUN grep "deepseek-chat-v3" ./backend/routes/agent.py && echo "✅ DeepSeek V3 in models"
|
| 41 |
+
|
| 42 |
+
# Override main.py and config
|
| 43 |
COPY backend/main.py ./backend/main.py
|
| 44 |
COPY configs/frontend_agent_config.json ./configs/frontend_agent_config.json
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
|
|
|
| 46 |
RUN mkdir -p /app/session_logs && chown -R user:user /app
|
| 47 |
|
| 48 |
USER user
|