Skip to content

Commit 52cb2d0

Browse files
committed
Refactor to install from npm instead of building from git
1 parent 33e1f19 commit 52cb2d0

8 files changed

Lines changed: 21 additions & 53 deletions

File tree

.github/workflows/auto_check.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,24 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313
with:
14-
submodules: true
1514
fetch-depth: 0
1615

17-
- name: Get current submodule commit
16+
- name: Get current upstream version
1817
id: current
19-
run: echo "sha=$(git -C openclaw rev-parse HEAD)" >> "$GITHUB_OUTPUT"
20-
21-
- name: Fetch latest upstream release
22-
id: upstream
23-
env:
24-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2518
run: |
26-
LATEST=$(gh api repos/openclaw/openclaw/releases/latest --jq '.tag_name')
27-
echo "tag=$LATEST" >> "$GITHUB_OUTPUT"
28-
# Strip leading 'v' if present for the version string
29-
VERSION="${LATEST#v}"
19+
VERSION=$(jq -r '.upstreamVersion' dappnode_package.json)
3020
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
3121
32-
- name: Update submodule to latest release
33-
id: update
22+
- name: Fetch latest npm version
23+
id: upstream
3424
run: |
35-
cd openclaw
36-
git fetch --tags origin
37-
git checkout ${{ steps.upstream.outputs.tag }}
38-
cd ..
39-
NEW_SHA=$(git -C openclaw rev-parse HEAD)
40-
echo "sha=$NEW_SHA" >> "$GITHUB_OUTPUT"
25+
LATEST=$(npm view openclaw version)
26+
echo "version=$LATEST" >> "$GITHUB_OUTPUT"
4127
4228
- name: Check if update is needed
4329
id: check
4430
run: |
45-
if [ "${{ steps.current.outputs.sha }}" = "${{ steps.update.outputs.sha }}" ]; then
31+
if [ "${{ steps.current.outputs.version }}" = "${{ steps.upstream.outputs.version }}" ]; then
4632
echo "changed=false" >> "$GITHUB_OUTPUT"
4733
else
4834
echo "changed=true" >> "$GITHUB_OUTPUT"
@@ -72,11 +58,11 @@ jobs:
7258
fi
7359
7460
git checkout -b "$BRANCH"
75-
git add openclaw dappnode_package.json
61+
git add dappnode_package.json
7662
git commit -m "Bump openclaw upstream to ${VERSION}"
7763
git push origin "$BRANCH"
7864
7965
gh pr create \
8066
--title "Bump openclaw upstream to ${VERSION}" \
81-
--body "Bumps openclaw submodule to release \`${{ steps.upstream.outputs.tag }}\`." \
67+
--body "Bumps openclaw npm package to version \`${VERSION}\`." \
8268
--base main

.github/workflows/main.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
if: github.event_name != 'push'
1717
steps:
1818
- uses: actions/checkout@v4
19-
with:
20-
submodules: true
2119
- uses: actions/setup-node@v4
2220
with:
2321
node-version: "22"
@@ -29,8 +27,6 @@ jobs:
2927
if: github.event_name == 'push' || github.event_name == 'repository_dispatch'
3028
steps:
3129
- uses: actions/checkout@v4
32-
with:
33-
submodules: true
3430
- uses: actions/setup-node@v4
3531
with:
3632
node-version: "22"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Former git submodule (now installed via npm at build time)
2+
openclaw/
3+
14
# Build artifacts
25
build_*/
36
*.xz

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

Dockerfile

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ ARG UPSTREAM_VERSION="latest"
22

33
FROM node:22-bookworm
44

5-
# Install Bun (required for build scripts) and sudo (needed by openclaw tool executor)
5+
# Install Bun (required by openclaw at runtime) and sudo (needed by openclaw tool executor)
66
RUN curl -fsSL https://bun.sh/install | bash && \
77
apt-get update && \
88
apt-get install -y --no-install-recommends sudo && \
99
apt-get clean && \
1010
rm -rf /var/lib/apt/lists/*
1111
ENV PATH="/root/.bun/bin:${PATH}"
1212

13-
RUN corepack enable
14-
1513
WORKDIR /app
1614

1715
ARG OPENCLAW_DOCKER_APT_PACKAGES=""
@@ -22,21 +20,11 @@ RUN if [ -n "$OPENCLAW_DOCKER_APT_PACKAGES" ]; then \
2220
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \
2321
fi
2422

25-
COPY openclaw/package.json openclaw/pnpm-lock.yaml openclaw/pnpm-workspace.yaml openclaw/.npmrc ./
26-
COPY openclaw/ui/package.json ./ui/package.json
27-
COPY openclaw/patches ./patches
28-
COPY openclaw/scripts ./scripts
29-
30-
RUN pnpm install --frozen-lockfile
31-
32-
COPY openclaw/ .
33-
RUN OPENCLAW_A2UI_SKIP_MISSING=1 pnpm build
34-
# Force pnpm for UI build (Bun may fail on ARM/Synology architectures)
35-
ENV OPENCLAW_PREFER_PNPM=1
36-
RUN pnpm ui:build
23+
ARG UPSTREAM_VERSION
24+
RUN npm install -g openclaw@${UPSTREAM_VERSION}
3725

38-
# Make the openclaw CLI available in PATH
39-
RUN ln -s /app/openclaw.mjs /usr/local/bin/openclaw
26+
# Make json5 (openclaw dependency) resolvable by plain require('json5')
27+
ENV NODE_PATH=/usr/local/lib/node_modules
4028

4129
ENV NODE_ENV=production
4230

@@ -66,4 +54,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
6654

6755
# Run as root (no-new-privileges prevents privilege escalation via gosu/sudo)
6856
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
69-
CMD ["node", "dist/index.js", "gateway", "--allow-unconfigured"]
57+
CMD ["openclaw", "gateway", "--allow-unconfigured"]

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
context: .
66
dockerfile: Dockerfile
77
args:
8-
UPSTREAM_VERSION: "latest"
8+
UPSTREAM_VERSION: "2026.3.2"
99
image: "openclaw.dnp.dappnode.eth:0.1.0"
1010
container_name: DAppNodePackage-openclaw.dnp.dappnode.eth
1111
restart: unless-stopped
@@ -26,8 +26,7 @@ services:
2626
max-size: "10m"
2727
max-file: "3"
2828
command:
29-
- "node"
30-
- "dist/index.js"
29+
- "openclaw"
3130
- "gateway"
3231
- "--allow-unconfigured"
3332

entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ EOF
2929
else
3030
node -e "
3131
const fs = require('fs');
32-
const JSON5 = require('/app/node_modules/json5');
32+
const JSON5 = require('json5');
3333
const configPath = '$CONFIG_FILE';
3434
try {
3535
const config = JSON5.parse(fs.readFileSync(configPath, 'utf8'));

openclaw

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)