Files
opencode/Dockerfile
T
Hermes Agent 988bf26667
PR Checks / hadolint (pull_request) Successful in 6s
PR Checks / build-test (pull_request) Failing after 39s
fix: install n2-soul with --ignore-scripts, then upgrade better-sqlite3
n2-soul's npm install fails on Node 26 because its dependency
better-sqlite3@11.10.0 cannot compile (V8 API removed GetPrototype).
The subsequent upgrade to v12 never runs due to set -eux.

Fix: install n2-soul without scripts, then replace better-sqlite3
with v12.11.1 which has prebuilt binaries for Node 26.

open-code-ai is installed separately with scripts allowed.
2026-07-13 23:26:20 +00:00

32 lines
1.1 KiB
Docker

FROM node:26-trixie
ENV NPM_CONFIG_UPDATE_NOTIFIER=false \
NPM_CONFIG_LOGLEVEL=warn \
NODE_ENV=production
# hadolint ignore=DL3003
RUN apt-get update && \
apt-get upgrade -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/* && \
set -eux; \
userdel -r node; \
groupadd -g 1000 opencode; \
useradd -m -u 1000 -g 1000 -s /usr/bin/bash opencode; \
npm update -g --no-fund --no-audit && \
npm install -g --no-fund --no-audit --ignore-scripts n2-soul@9.0.9 && \
rm -rf /usr/local/lib/node_modules/n2-soul/node_modules/better-sqlite3 && \
(cd /usr/local/lib/node_modules/n2-soul && npm install --no-fund --no-audit --no-save --allow-scripts=better-sqlite3 better-sqlite3@12.11.1) && \
npm install -g --no-fund --no-audit --allow-scripts=opencode-ai opencode-ai@1.17.18 && \
npm cache clean --force && \
chown -R 1000:1000 /usr/local/lib/node_modules/n2-soul/
COPY --chmod=755 opencode-attach /usr/local/bin/opencode-attach
COPY --from=registry.k8s.io/kubectl:v1.36.2 /bin/kubectl /usr/local/bin/kubectl
USER opencode
WORKDIR /home/opencode
RUN opencode --version
ENTRYPOINT ["opencode"]