Simford.Dong commited on
Commit ·
8781b06
1
Parent(s): f6bd16b
fix: improve startup script robustness and fix config errors
Browse files- Dockerfile +8 -8
Dockerfile
CHANGED
|
@@ -6,8 +6,10 @@ RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
|
|
| 6 |
# Install OpenClaw globally
|
| 7 |
RUN npm install -g openclaw@latest
|
| 8 |
|
| 9 |
-
# Download and install Feishu plugin
|
| 10 |
-
RUN
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Create config directory
|
| 13 |
RUN mkdir -p /root/.openclaw
|
|
@@ -38,9 +40,8 @@ mkdir -p /root/.openclaw/credentials\n\
|
|
| 38 |
# Remove auth-profiles.json if it exists to force env var usage\n\
|
| 39 |
rm -f /root/.openclaw/agents/main/agent/auth-profiles.json\n\
|
| 40 |
\n\
|
| 41 |
-
#
|
| 42 |
-
|
| 43 |
-
cat > /root/.openclaw/openclaw.json << EOF\n\
|
| 44 |
{\n\
|
| 45 |
"env": {\n\
|
| 46 |
"GOOGLE_API_KEY": "${GEMINI_API_KEY_1}",\n\
|
|
@@ -83,19 +84,18 @@ if [ ! -f /root/.openclaw/openclaw.json ]; then\n\
|
|
| 83 |
}\n\
|
| 84 |
}\n\
|
| 85 |
EOF\n\
|
| 86 |
-
fi\n\
|
| 87 |
\n\
|
| 88 |
# Fix permissions\n\
|
| 89 |
chmod 700 /root/.openclaw\n\
|
| 90 |
chmod 600 /root/.openclaw/openclaw.json\n\
|
| 91 |
-
chmod 600 /root/.openclaw/agents/main/agent/auth-profiles.json\n\
|
| 92 |
\n\
|
| 93 |
# Fix config if needed\n\
|
| 94 |
openclaw doctor --fix\n\
|
| 95 |
\n\
|
| 96 |
# Start OpenClaw gateway\n\
|
| 97 |
echo "Starting OpenClaw gateway on port 7860..."\n\
|
| 98 |
-
exec openclaw gateway run --port 7860\n\
|
| 99 |
' > /usr/local/bin/start-openclaw && chmod +x /usr/local/bin/start-openclaw
|
| 100 |
|
| 101 |
CMD ["/usr/local/bin/start-openclaw"]
|
|
|
|
| 6 |
# Install OpenClaw globally
|
| 7 |
RUN npm install -g openclaw@latest
|
| 8 |
|
| 9 |
+
# Download and install Feishu plugin (only if not already present as an extension)
|
| 10 |
+
RUN if [ ! -d "/usr/local/lib/node_modules/openclaw/extensions/feishu" ]; then \
|
| 11 |
+
openclaw plugins install @m1heng-clawd/feishu; \
|
| 12 |
+
fi
|
| 13 |
|
| 14 |
# Create config directory
|
| 15 |
RUN mkdir -p /root/.openclaw
|
|
|
|
| 40 |
# Remove auth-profiles.json if it exists to force env var usage\n\
|
| 41 |
rm -f /root/.openclaw/agents/main/agent/auth-profiles.json\n\
|
| 42 |
\n\
|
| 43 |
+
# Always ensure we have a clean config with required values\n\
|
| 44 |
+
cat > /root/.openclaw/openclaw.json << EOF\n\
|
|
|
|
| 45 |
{\n\
|
| 46 |
"env": {\n\
|
| 47 |
"GOOGLE_API_KEY": "${GEMINI_API_KEY_1}",\n\
|
|
|
|
| 84 |
}\n\
|
| 85 |
}\n\
|
| 86 |
EOF\n\
|
|
|
|
| 87 |
\n\
|
| 88 |
# Fix permissions\n\
|
| 89 |
chmod 700 /root/.openclaw\n\
|
| 90 |
chmod 600 /root/.openclaw/openclaw.json\n\
|
| 91 |
+
[ -f /root/.openclaw/agents/main/agent/auth-profiles.json ] && chmod 600 /root/.openclaw/agents/main/agent/auth-profiles.json\n\
|
| 92 |
\n\
|
| 93 |
# Fix config if needed\n\
|
| 94 |
openclaw doctor --fix\n\
|
| 95 |
\n\
|
| 96 |
# Start OpenClaw gateway\n\
|
| 97 |
echo "Starting OpenClaw gateway on port 7860..."\n\
|
| 98 |
+
exec openclaw gateway run --port 7860 --allow-unconfigured\n\
|
| 99 |
' > /usr/local/bin/start-openclaw && chmod +x /usr/local/bin/start-openclaw
|
| 100 |
|
| 101 |
CMD ["/usr/local/bin/start-openclaw"]
|