rahul7star commited on
Commit
abbed9d
·
verified ·
1 Parent(s): 4e144f2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -39
Dockerfile CHANGED
@@ -1,17 +1,10 @@
1
- # Pencilclaw HF Space Dockerfile
2
  FROM ubuntu:22.04
3
 
4
- # -------------------------
5
- # Environment variables
6
- # -------------------------
7
  ENV DEBIAN_FRONTEND=noninteractive
8
  ENV MODEL_NAME="qwen2.5:0.5b"
9
  ENV OLLAMA_HOST="0.0.0.0:11434"
10
- ENV OLLAMA_KEEP_ALIVE=24h
11
 
12
- # -------------------------
13
- # Install system dependencies
14
- # -------------------------
15
  RUN apt-get update && apt-get install -y \
16
  build-essential \
17
  libcurl4-openssl-dev \
@@ -23,50 +16,29 @@ RUN apt-get update && apt-get install -y \
23
  zstd \
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
- # -------------------------
27
- # Install Ollama (reliable)
28
- # -------------------------
29
- RUN curl --retry 5 --retry-delay 3 -fSL https://ollama.com/install.sh -o /tmp/ollama_install.sh \
30
- && sh /tmp/ollama_install.sh \
31
- && rm /tmp/ollama_install.sh
32
 
33
- # -------------------------
34
- # Python dependencies
35
- # -------------------------
36
- RUN pip3 install --no-cache-dir --upgrade pip \
37
- && pip3 install --no-cache-dir streamlit requests
38
 
39
- # -------------------------
40
  # Working directory
41
- # -------------------------
42
  WORKDIR /workspace
43
 
44
- # Copy all project files
45
  COPY . /workspace/
46
 
47
- # -------------------------
48
- # Compile Pencilclaw C++ binary
49
- # -------------------------
50
  RUN g++ -std=c++17 -I/usr/include/cjson -o /workspace/pencilclaw /workspace/pencilclaw.cpp -lcurl -lcjson
51
 
52
- # -------------------------
53
- # Create data folder
54
- # -------------------------
55
  RUN mkdir -p /workspace/pencil_data
 
56
  RUN chmod +x /workspace/pencilclaw
57
  RUN chmod +x /workspace/entrypoint.sh
58
 
59
- # -------------------------
60
- # Pre-download Ollama model (critical for fast startup)
61
- # -------------------------
62
- RUN ollama serve & sleep 5 && ollama pull ${MODEL_NAME}
63
-
64
- # -------------------------
65
- # Expose Streamlit port for HF Spaces
66
- # -------------------------
67
  EXPOSE 7860
68
 
69
- # -------------------------
70
- # Start entrypoint
71
- # -------------------------
72
  CMD ["/workspace/entrypoint.sh"]
 
 
1
  FROM ubuntu:22.04
2
 
 
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
  ENV MODEL_NAME="qwen2.5:0.5b"
5
  ENV OLLAMA_HOST="0.0.0.0:11434"
 
6
 
7
+ # Install dependencies
 
 
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  libcurl4-openssl-dev \
 
16
  zstd \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # Install Ollama
20
+ RUN curl -fsSL https://ollama.com/install.sh | sh
 
 
 
 
21
 
22
+ # Python deps
23
+ RUN pip3 install --upgrade pip \
24
+ && pip3 install streamlit requests
 
 
25
 
 
26
  # Working directory
 
27
  WORKDIR /workspace
28
 
29
+ # Copy entire repo
30
  COPY . /workspace/
31
 
32
+ # Compile C++ app
 
 
33
  RUN g++ -std=c++17 -I/usr/include/cjson -o /workspace/pencilclaw /workspace/pencilclaw.cpp -lcurl -lcjson
34
 
35
+ # Data folder
 
 
36
  RUN mkdir -p /workspace/pencil_data
37
+
38
  RUN chmod +x /workspace/pencilclaw
39
  RUN chmod +x /workspace/entrypoint.sh
40
 
41
+ # HF Spaces port
 
 
 
 
 
 
 
42
  EXPOSE 7860
43
 
 
 
 
44
  CMD ["/workspace/entrypoint.sh"]