Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +62 -10
Dockerfile
CHANGED
|
@@ -1,30 +1,82 @@
|
|
|
|
|
| 1 |
FROM debian:bullseye-slim
|
| 2 |
|
| 3 |
-
# Install core dependencies and ripgrep (required for Claude grep tool)
|
| 4 |
RUN apt-get update && apt-get install -y curl unzip git tmux sudo qrencode ripgrep && rm -rf /var/lib/apt/lists/*
|
| 5 |
|
| 6 |
-
# Install ttyd (The web-terminal bridge)
|
| 7 |
RUN curl -Ls https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64 -o /usr/local/bin/ttyd && chmod +x /usr/local/bin/ttyd
|
| 8 |
|
| 9 |
-
# Create a secure user environment
|
| 10 |
RUN useradd -m -s /bin/bash coder && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 11 |
USER coder
|
| 12 |
WORKDIR /home/coder
|
| 13 |
|
| 14 |
-
# Install Bun
|
| 15 |
RUN curl -fsSL https://bun.sh/install | bash
|
| 16 |
ENV PATH="/home/coder/.bun/bin:${PATH}"
|
| 17 |
|
| 18 |
-
# Clone and build Gitlawb's OpenClaude
|
| 19 |
RUN git clone --depth=1 https://github.com/Gitlawb/openclaude.git /home/coder/openclaude
|
| 20 |
WORKDIR /home/coder/openclaude
|
| 21 |
RUN bun install && bun run build || true
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
EXPOSE 7860
|
| 30 |
CMD ["/home/coder/start.sh"]
|
|
|
|
| 1 |
+
# syntax=docker/dockerfile:1.4
|
| 2 |
FROM debian:bullseye-slim
|
| 3 |
|
| 4 |
+
# 1. Install core dependencies and ripgrep (required for Claude grep tool)
|
| 5 |
RUN apt-get update && apt-get install -y curl unzip git tmux sudo qrencode ripgrep && rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
+
# 2. Install ttyd (The web-terminal bridge)
|
| 8 |
RUN curl -Ls https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64 -o /usr/local/bin/ttyd && chmod +x /usr/local/bin/ttyd
|
| 9 |
|
| 10 |
+
# 3. Create a secure user environment
|
| 11 |
RUN useradd -m -s /bin/bash coder && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 12 |
USER coder
|
| 13 |
WORKDIR /home/coder
|
| 14 |
|
| 15 |
+
# 4. Install Bun
|
| 16 |
RUN curl -fsSL https://bun.sh/install | bash
|
| 17 |
ENV PATH="/home/coder/.bun/bin:${PATH}"
|
| 18 |
|
| 19 |
+
# 5. Clone and build Gitlawb's OpenClaude
|
| 20 |
RUN git clone --depth=1 https://github.com/Gitlawb/openclaude.git /home/coder/openclaude
|
| 21 |
WORKDIR /home/coder/openclaude
|
| 22 |
RUN bun install && bun run build || true
|
| 23 |
|
| 24 |
+
# 6. GENERATE settings.json internally
|
| 25 |
+
RUN mkdir -p /home/coder/openclaude/.openclaude && cat <<'EOF' > /home/coder/openclaude/.openclaude/settings.json
|
| 26 |
+
{
|
| 27 |
+
"agentModels": {
|
| 28 |
+
"z-ai/glm5": {
|
| 29 |
+
"base_url": "https://integrate.api.nvidia.com/v1",
|
| 30 |
+
"api_key": "${NVIDIA_API_KEY}"
|
| 31 |
+
},
|
| 32 |
+
"moonshotai/kimi-k2.5": {
|
| 33 |
+
"base_url": "https://integrate.api.nvidia.com/v1",
|
| 34 |
+
"api_key": "${NVIDIA_API_KEY}"
|
| 35 |
+
},
|
| 36 |
+
"minimax/minimax-m2.5": {
|
| 37 |
+
"base_url": "https://integrate.api.nvidia.com/v1",
|
| 38 |
+
"api_key": "${NVIDIA_API_KEY}"
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
"agentRouting": {
|
| 42 |
+
"default": "z-ai/glm5"
|
| 43 |
+
},
|
| 44 |
+
"fallbackChain": [
|
| 45 |
+
"z-ai/glm5",
|
| 46 |
+
"moonshotai/kimi-k2.5",
|
| 47 |
+
"minimax/minimax-m2.5"
|
| 48 |
+
]
|
| 49 |
+
}
|
| 50 |
+
EOF
|
| 51 |
+
|
| 52 |
+
# 7. GENERATE CLAUDE.md internally
|
| 53 |
+
RUN cat <<'EOF' > /home/coder/openclaude/CLAUDE.md
|
| 54 |
+
# OpenClaude Agent Settings
|
| 55 |
+
You are an autonomous coding agent running on GLM-5 via NVIDIA NIM.
|
| 56 |
+
Use tools dynamically (Bash, File Read/Write, Grep, Glob, WebFetch).
|
| 57 |
+
CRITICAL: You must ALWAYS ask for permission before executing destructive shell commands (rm, drop, format, git push force).
|
| 58 |
+
EOF
|
| 59 |
+
|
| 60 |
+
# 8. GENERATE start.sh internally
|
| 61 |
+
RUN cat <<'EOF' > /home/coder/start.sh
|
| 62 |
+
#!/bin/bash
|
| 63 |
+
|
| 64 |
+
# Start OpenClaude inside a detached, persistent tmux session named "agent"
|
| 65 |
+
tmux new-session -d -s agent 'cd /home/coder/openclaude && CLAUDE_CODE_USE_OPENAI=1 OPENAI_MODEL=z-ai/glm5 OPENAI_BASE_URL=https://integrate.api.nvidia.com/v1 OPENAI_API_KEY=$NVIDIA_API_KEY bun run dev'
|
| 66 |
|
| 67 |
+
# Generate the Remote Control QR Code in the Hugging Face logs
|
| 68 |
+
SPACE_URL="https://${SPACE_HOST}"
|
| 69 |
+
echo "=========================================================="
|
| 70 |
+
echo " REMOTE CONTROL: SCAN THIS QR CODE WITH YOUR PHONE ONCE "
|
| 71 |
+
qrencode -t ANSIUTF8 "${SPACE_URL}"
|
| 72 |
+
echo " URL: ${SPACE_URL}"
|
| 73 |
+
echo "=========================================================="
|
| 74 |
+
|
| 75 |
+
# Serve the tmux session to the web via ttyd
|
| 76 |
+
exec ttyd -p 7860 -c "${WEB_USER}:${WEB_PASS}" tmux attach -t agent
|
| 77 |
+
EOF
|
| 78 |
+
|
| 79 |
+
# 9. Set permissions and run
|
| 80 |
+
RUN chmod +x /home/coder/start.sh
|
| 81 |
EXPOSE 7860
|
| 82 |
CMD ["/home/coder/start.sh"]
|