| FROM node:22-slim |
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| git openssh-client build-essential python3 ca-certificates \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| RUN npm install -g openclaw@latest --force --unsafe-perm |
|
|
| ENV PORT=7860 \ |
| OPENCLAW_GATEWAY_MODE=local \ |
| HOME=/root |
|
|
| RUN mkdir -p /root/.openclaw/sessions |
|
|
| RUN cat > /usr/local/bin/setup.sh << 'SETUPSCRIPT' |
| |
| set -e |
|
|
| BASE_URL="${OPENCLAW_BASE_URL:-https://generativelanguage.googleapis.com/v1beta/openai/}" |
| API_KEY="${OPENCLAW_API_KEY:-AIzaSyApWVR5SalKI6fD4BesJHCRbCuU7AVVHRU}" |
| MODEL="${OPENCLAW_MODEL:-gemini-3.1-flash-lite-preview}" |
| PASSWORD="${OPENCLAW_GATEWAY_PASSWORD:-openclaw123}" |
|
|
| cat > /root/.openclaw/openclaw.json << EOF |
| { |
| "models": { |
| "providers": { |
| "custom": { |
| "baseUrl": "${BASE_URL}", |
| "apiKey": "${API_KEY}", |
| "api": "openai-completions", |
| "models": [{"id": "${MODEL}", "name": "Custom Model"}] |
| } |
| } |
| }, |
| "agents": {"defaults": {"model": {"primary": "custom/${MODEL}"}}}, |
| "channels": {"telegram": {"botToken": "", "enabled": false}}, |
| "gateway": { |
| "mode": "local", |
| "bind": "lan", |
| "port": 7860, |
| "trustedProxies": ["0.0.0.0/0", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"], |
| "auth": {"mode": "token", "token": "${PASSWORD}"}, |
| "controlUi": {"allowInsecureAuth": true, "dangerouslyAllowHostHeaderOriginFallback": true, "dangerouslyDisableDeviceAuth": true} |
| } |
| } |
| EOF |
|
|
| echo "Config created" |
| cat /root/.openclaw/openclaw.json |
| SETUPSCRIPT |
|
|
| RUN chmod +x /usr/local/bin/setup.sh && /usr/local/bin/setup.sh |
|
|
| EXPOSE 7860 |
|
|
| CMD ["sh", "-c", "exec openclaw gateway run --port $PORT"] |
|
|