File size: 1,343 Bytes
b008b36 3e9f090 b008b36 32aeafe b008b36 5658b44 3e9f090 b008b36 3e9f090 b008b36 9d4ff31 b008b36 5658b44 b008b36 5658b44 3e9f090 b008b36 38d2985 b008b36 3e9f090 fc6198b de61650 cd3fbc3 6d80669 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # We MUST use Node 22 for the build to succeed
FROM node:22
# 1. Install Security Certificates
RUN apt-get update && apt-get install -y ca-certificates openssl && update-ca-certificates
# 2. Install pnpm
RUN npm install -g pnpm
WORKDIR /app
# 3. Clone the bot
RUN git clone https://github.com/openclaw/openclaw.git .
# --- FIX 1: The "IPv4 Implant" ---
# This script forces the bot to ignore IPv6, fixing the "Fetch Failed" error.
RUN echo "const dns = require('dns'); \
if (dns.setDefaultResultOrder) { dns.setDefaultResultOrder('ipv4first'); } \
const os = require('os'); os.hostname = () => 'clawbot';" > /app/system_patch.cjs
# 4. Install Dependencies
RUN pnpm install
# 5. Build the bot (This will succeed on Node 22)
RUN pnpm run build
# --- FIX 2: Force Port & Address ---
RUN grep -rl "127.0.0.1" . | xargs sed -i 's/127.0.0.1/0.0.0.0/g'
RUN grep -rl "18789" . | xargs sed -i 's/18789/7860/g'
# --- FIX 3: Apply the Patch ---
# We load the system_patch.cjs before anything else runs.
# We also disable SSL strictness just in case that was blocking it.
ENV NODE_OPTIONS="--max-old-space-size=8192 --require /app/system_patch.cjs"
ENV NODE_TLS_REJECT_UNAUTHORIZED="0"
# Gateway Password
ENV OPENCLAW_GATEWAY_TOKEN="12345-secret-password"
# Start the bot
CMD ["node", "scripts/run-node.mjs", "gateway", "--allow-unconfigured"]
|