Spaces:
Paused
Paused
Add Dockerfile that builds from smolagents/ml-intern source
Browse files- Dockerfile +40 -0
Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Clone and build from smolagents/ml-intern source
|
| 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 |
+
# Stage 2: Production
|
| 9 |
+
FROM python:3.12-slim
|
| 10 |
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
| 11 |
+
RUN useradd -m -u 1000 user
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
RUN apt-get update && apt-get install -y --no-install-recommends git curl && rm -rf /var/lib/apt/lists/*
|
| 14 |
+
|
| 15 |
+
# Clone source
|
| 16 |
+
RUN git clone --depth 1 https://huggingface.co/spaces/smolagents/ml-intern /tmp/source && \
|
| 17 |
+
cp /tmp/source/pyproject.toml /tmp/source/uv.lock ./ && \
|
| 18 |
+
cp -r /tmp/source/agent ./agent && \
|
| 19 |
+
cp -r /tmp/source/backend ./backend && \
|
| 20 |
+
cp -r /tmp/source/configs ./configs && \
|
| 21 |
+
rm -rf /tmp/source
|
| 22 |
+
|
| 23 |
+
# Install dependencies
|
| 24 |
+
RUN uv sync --no-dev --frozen
|
| 25 |
+
|
| 26 |
+
# Copy built frontend
|
| 27 |
+
COPY --from=frontend-builder /source/frontend/dist ./static/
|
| 28 |
+
|
| 29 |
+
# Create directories
|
| 30 |
+
RUN mkdir -p /app/session_logs && chown -R user:user /app
|
| 31 |
+
|
| 32 |
+
USER user
|
| 33 |
+
ENV HOME=/home/user \
|
| 34 |
+
PYTHONUNBUFFERED=1 \
|
| 35 |
+
PYTHONPATH=/app \
|
| 36 |
+
PATH="/app/.venv/bin:$PATH"
|
| 37 |
+
|
| 38 |
+
EXPOSE 7860
|
| 39 |
+
WORKDIR /app/backend
|
| 40 |
+
CMD ["bash", "start.sh"]
|