Update Dockerfile
Browse files- Dockerfile +14 -12
Dockerfile
CHANGED
|
@@ -1,16 +1,13 @@
|
|
| 1 |
# Use Node.js 22 (required by OpenClaw) as the base image
|
| 2 |
FROM node:22-bookworm-slim
|
| 3 |
|
| 4 |
-
# Install required system tools
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
git curl procps zstd \
|
| 7 |
&& curl -fsSL https://ollama.com/install.sh | sh \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
# We will use this existing user to satisfy Hugging Face's requirements.
|
| 12 |
-
|
| 13 |
-
# Create directories and assign ownership to the "node" user before switching
|
| 14 |
RUN mkdir -p /home/node/.ollama && chown -R node:node /home/node/.ollama
|
| 15 |
RUN mkdir -p /home/node/.npm-global && chown -R node:node /home/node/.npm-global
|
| 16 |
RUN mkdir -p /home/node/.openclaw && chown -R node:node /home/node/.openclaw
|
|
@@ -26,18 +23,23 @@ RUN npm config set prefix '~/.npm-global'
|
|
| 26 |
RUN npm install -g openclaw@latest
|
| 27 |
RUN mkdir -p $HOME/.openclaw/workspace
|
| 28 |
|
| 29 |
-
# Pre-download the Qwen 2.5 Coder 14B model during the Docker build phase
|
| 30 |
-
RUN nohup bash -c "ollama serve &" && \
|
| 31 |
-
sleep 5 && \
|
| 32 |
-
ollama pull qwen2.5-coder:14b
|
| 33 |
-
|
| 34 |
# Expose the Hugging Face web port
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
-
# Create a startup script that
|
| 38 |
RUN echo '#!/bin/bash\n\
|
|
|
|
| 39 |
ollama serve &\n\
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
openclaw gateway --bind 0.0.0.0 --port 7860\n\
|
| 42 |
' > start.sh && chmod +x start.sh
|
| 43 |
|
|
|
|
| 1 |
# Use Node.js 22 (required by OpenClaw) as the base image
|
| 2 |
FROM node:22-bookworm-slim
|
| 3 |
|
| 4 |
+
# Install required system tools and Ollama for the local model
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
git curl procps zstd \
|
| 7 |
&& curl -fsSL https://ollama.com/install.sh | sh \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Create directories and assign ownership to the built-in "node" user
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN mkdir -p /home/node/.ollama && chown -R node:node /home/node/.ollama
|
| 12 |
RUN mkdir -p /home/node/.npm-global && chown -R node:node /home/node/.npm-global
|
| 13 |
RUN mkdir -p /home/node/.openclaw && chown -R node:node /home/node/.openclaw
|
|
|
|
| 23 |
RUN npm install -g openclaw@latest
|
| 24 |
RUN mkdir -p $HOME/.openclaw/workspace
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
# Expose the Hugging Face web port
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
+
# Create a robust startup script that handles Ollama safely
|
| 30 |
RUN echo '#!/bin/bash\n\
|
| 31 |
+
echo "Starting Ollama server..."\n\
|
| 32 |
ollama serve &\n\
|
| 33 |
+
\n\
|
| 34 |
+
echo "Waiting for Ollama server to be active..."\n\
|
| 35 |
+
while ! ollama list > /dev/null 2>&1; do\n\
|
| 36 |
+
sleep 1\n\
|
| 37 |
+
done\n\
|
| 38 |
+
\n\
|
| 39 |
+
echo "Ollama is up! Pulling Qwen 2.5 Coder 14B..."\n\
|
| 40 |
+
ollama pull qwen2.5-coder:14b\n\
|
| 41 |
+
\n\
|
| 42 |
+
echo "Model ready! Starting OpenClaw..."\n\
|
| 43 |
openclaw gateway --bind 0.0.0.0 --port 7860\n\
|
| 44 |
' > start.sh && chmod +x start.sh
|
| 45 |
|