bep40 commited on
Commit
e3310d6
·
verified ·
1 Parent(s): de5a378

Restore Dockerfile from commit 36e2e7f8

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -38
Dockerfile CHANGED
@@ -1,60 +1,47 @@
1
- # Stage 1: Build frontend
2
  FROM node:20-alpine AS frontend-builder
3
- WORKDIR /app/frontend
4
- COPY frontend/package.json frontend/package-lock.json ./
5
- RUN npm install
6
- COPY frontend/ ./
7
- RUN npm run build
 
 
 
 
8
 
9
  # Stage 2: Production
10
  FROM python:3.12-slim
11
-
12
- # Install uv directly from official image
13
  COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
14
-
15
- # Create user with UID 1000 (required for HF Spaces)
16
  RUN useradd -m -u 1000 user
17
-
18
  WORKDIR /app
 
19
 
20
- # Install system dependencies
21
- RUN apt-get update && apt-get install -y --no-install-recommends \
22
- git \
23
- curl \
24
- bash \
25
- && rm -rf /var/lib/apt/lists/*
26
-
27
- # Copy dependency files
28
- COPY pyproject.toml uv.lock ./
29
 
30
- # Install dependencies into /app/.venv
31
- # Use --frozen to ensure exact versions from uv.lock
32
  RUN uv sync --no-dev --frozen
33
 
34
- # Copy application code
35
- COPY agent/ ./agent/
36
- COPY backend/ ./backend/
37
- COPY configs/ ./configs/
38
 
39
- # Copy built frontend
40
- COPY --from=frontend-builder /app/frontend/dist ./static/
 
41
 
42
- # Create directories and set ownership
43
- RUN mkdir -p /app/session_logs && \
44
- chown -R user:user /app
45
 
46
- # Switch to non-root user
47
  USER user
48
-
49
- # Set environment
50
  ENV HOME=/home/user \
51
  PYTHONUNBUFFERED=1 \
52
  PYTHONPATH=/app \
53
  PATH="/app/.venv/bin:$PATH"
54
 
55
- # Expose port
56
  EXPOSE 7860
57
-
58
- # Run the application from backend directory
59
  WORKDIR /app/backend
60
- CMD ["bash", "start.sh"]
 
 
1
+ # Restore from 4bac0e2 + patch frontend + backend models
2
  FROM node:20-alpine AS frontend-builder
3
+ RUN apk add --no-cache git python3
4
+ RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /source
5
+
6
+ # Patch frontend: add Gemini + Qwen3 models to dropdown
7
+ COPY patch_frontend.py /tmp/patch_frontend.py
8
+ RUN python3 /tmp/patch_frontend.py
9
+
10
+ WORKDIR /source/frontend
11
+ RUN npm install && npm run build
12
 
13
  # Stage 2: Production
14
  FROM python:3.12-slim
 
 
15
  COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
 
 
16
  RUN useradd -m -u 1000 user
 
17
  WORKDIR /app
18
+ RUN apt-get update && apt-get install -y --no-install-recommends git curl ca-certificates && rm -rf /var/lib/apt/lists/*
19
 
20
+ RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /tmp/source && \
21
+ cp /tmp/source/pyproject.toml /tmp/source/uv.lock ./ && \
22
+ cp -r /tmp/source/agent ./agent && \
23
+ cp -r /tmp/source/backend ./backend && \
24
+ cp -r /tmp/source/configs ./configs && \
25
+ rm -rf /tmp/source
 
 
 
26
 
 
 
27
  RUN uv sync --no-dev --frozen
28
 
29
+ COPY --from=frontend-builder /source/frontend/dist ./static/
30
+ COPY configs/frontend_agent_config.json ./configs/frontend_agent_config.json
 
 
31
 
32
+ # Patch backend: accept new model IDs
33
+ COPY patch_models.py /tmp/patch_models.py
34
+ RUN python /tmp/patch_models.py
35
 
36
+ RUN mkdir -p /app/session_logs && chown -R user:user /app
 
 
37
 
 
38
  USER user
 
 
39
  ENV HOME=/home/user \
40
  PYTHONUNBUFFERED=1 \
41
  PYTHONPATH=/app \
42
  PATH="/app/.venv/bin:$PATH"
43
 
 
44
  EXPOSE 7860
 
 
45
  WORKDIR /app/backend
46
+ # python:slim does not include bash by default; start.sh is POSIX-compatible.
47
+ CMD ["sh", "start.sh"]