Skip to content

Commit f681691

Browse files
committed
Fix install hang and wrong runtime command
Three bugs fixed: 1. Alpine → Debian base image (node:20-slim) opencode-ai's npm postinstall script downloads a platform binary using glibc detection. On Alpine (musl libc) it silently downloads the wrong binary or hangs — a known upstream bug (anomalyco/opencode#9571). Switching to node:20-slim (Debian) uses glibc and resolves this. 2. opencode web → opencode serve 'opencode web' attempts to open a browser. 'opencode serve' is the headless API/UI server designed for Docker — no TTY or display required. 3. Add io.hass.* LABEL and .dockerignore HA Supervisor expects these labels in the image. .dockerignore avoids sending README/meta files as Docker build context. https://claude.ai/code/session_01D6tLy8GBbwRq1QBeHD7u64
1 parent 7de3356 commit f681691

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎opencode/.dockerignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
README.md
2+
.dockerignore

‎opencode/Dockerfile‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
FROM node:20-alpine
1+
FROM node:20-slim
22

33
# System dependencies
44
# - git: required by OpenCode for file snapshots/undo
5-
# - bash: for run.sh
65
# - rsync: for efficient config backup/restore
76
# - jq: for parsing add-on options JSON
8-
# - curl: for HA Supervisor API calls and OpenCode install
9-
RUN apk add --no-cache git bash rsync jq curl
7+
# - curl: for HA Supervisor API calls
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
git \
10+
rsync \
11+
jq \
12+
curl \
13+
&& rm -rf /var/lib/apt/lists/*
1014

1115
# Install OpenCode globally via npm
16+
# node:20-slim is Debian/glibc — avoids the known musl/Alpine postinstall hang
1217
RUN npm install -g opencode-ai
1318

1419
# Install guardian dependencies
@@ -23,5 +28,10 @@ COPY guardian/ ./
2328
COPY run.sh /run.sh
2429
RUN chmod +x /run.sh
2530

31+
LABEL \
32+
io.hass.version="1.0.0" \
33+
io.hass.type="addon" \
34+
io.hass.arch="aarch64|amd64"
35+
2636
WORKDIR /config
2737
CMD ["/run.sh"]

‎opencode/guardian/server.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function startOpenCode() {
318318

319319
opencodeProcess = spawn(
320320
"opencode",
321-
["web", "--hostname", "127.0.0.1", "--port", String(OPENCODE_PORT)],
321+
["serve", "--hostname", "127.0.0.1", "--port", String(OPENCODE_PORT)],
322322
{
323323
cwd: CONFIG_DIR,
324324
stdio: "inherit",

0 commit comments

Comments
 (0)