Nihilitybot666 commited on
Commit
b008b36
·
verified ·
1 Parent(s): 28aa64a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -18
Dockerfile CHANGED
@@ -1,38 +1,38 @@
1
- # Use Node 20 (Stable Network)
2
- FROM node:20
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
- # --- GOD MODE FIX ---
16
- # The bot is too stupid to understand version numbers.
17
- # We search for the command "process.exit(1)" (which kills the bot)
18
- # and replace it with a print statement. Now it CANNOT stop itself.
19
- RUN grep -rl "process.exit(1)" . | xargs sed -i 's/process.exit(1)/console.log("CRASH PREVENTED");/g'
20
 
21
- # Install dependencies
22
  RUN pnpm install
23
 
24
- # Build the bot
25
  RUN pnpm run build
26
 
27
- # --- FIX: The "Mask" (Prevent Name Crash) ---
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
- # --- Network Settings ---
35
- ENV NODE_OPTIONS="--max-old-space-size=8192 --require /app/mask_hostname.cjs"
 
 
 
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"