kovinape commited on
Commit
cb3a997
Β·
verified Β·
1 Parent(s): bca0e01

Upload Dockerfile-1.txt

Browse files
Files changed (1) hide show
  1. Dockerfile-1.txt +59 -0
Dockerfile-1.txt ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ─────────────────────────────────────────────────────────────
2
+ # HF Docker Space β€” Ollama + Claude Code (web terminal)
3
+ # Exposed port : 7860 (only port HF Spaces forwards)
4
+ # Web terminal : ttyd (full interactive Claude CLI in browser)
5
+ # Model : gpt-oss:20b via Ollama Anthropic-compat API
6
+ # ─────────────────────────────────────────────────────────────
7
+ FROM ubuntu:22.04
8
+
9
+ ENV DEBIAN_FRONTEND=noninteractive
10
+
11
+ # ── System packages ──────────────────────────────────────────
12
+ RUN apt-get update && apt-get install -y \
13
+ curl wget git ca-certificates gnupg \
14
+ && \
15
+ # Node.js 20 LTS (needed by Claude Code CLI)
16
+ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
17
+ apt-get install -y nodejs && \
18
+ # Ollama
19
+ curl -fsSL https://ollama.com/install.sh | sh && \
20
+ # ttyd β€” browser-based terminal (static binary, no extra deps)
21
+ wget -q -O /usr/local/bin/ttyd \
22
+ https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64 && \
23
+ chmod +x /usr/local/bin/ttyd && \
24
+ rm -rf /var/lib/apt/lists/*
25
+
26
+ # ── Claude Code CLI (global npm install as root) ─────────────
27
+ RUN npm install -g @anthropic-ai/claude-code
28
+
29
+ # ── HF Spaces requires UID 1000 ──────────────────────────────
30
+ RUN useradd -m -u 1000 user
31
+
32
+ # Switch to user 1000 for all runtime operations
33
+ USER user
34
+ ENV HOME=/home/user
35
+ ENV PATH=/home/user/.local/bin:/usr/local/bin:$PATH
36
+
37
+ # ── Point Claude Code at local Ollama (no Anthropic key needed)
38
+ ENV ANTHROPIC_AUTH_TOKEN=ollama
39
+ ENV ANTHROPIC_API_KEY=ollama
40
+ ENV ANTHROPIC_BASE_URL=http://localhost:11434
41
+
42
+ # Ollama: listen on all interfaces so internal health-checks work
43
+ ENV OLLAMA_HOST=0.0.0.0:11434
44
+ # Store models under user home (writable at runtime)
45
+ ENV OLLAMA_MODELS=/home/user/.ollama/models
46
+
47
+ # Skip Claude Code's first-run login wizard
48
+ ENV CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
49
+
50
+ WORKDIR /home/user
51
+
52
+ # Copy startup script
53
+ COPY --chown=user entrypoint.sh /home/user/entrypoint.sh
54
+ RUN chmod +x /home/user/entrypoint.sh
55
+
56
+ # ── Only one port is forwarded by HF Spaces ──────────────────
57
+ EXPOSE 7860
58
+
59
+ CMD ["/home/user/entrypoint.sh"]