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