Build OpenCode from source in Docker and remove broken session token queries

- Dockerfile: Build OpenCode CLI from source during Docker build instead of downloading from GitHub releases
- Disabled GitHub Actions workflow that was failing to create releases
- Removed getOpencodeSessionTokenUsage function that tried non-existent CLI commands (session info/usage/show)
- Token tracking now relies on 3 layers: result extraction, streaming capture, and estimation
This commit is contained in:
southseact-3d
2026-02-16 16:38:22 +00:00
parent 4af4dc114f
commit 49983fbc3c
3 changed files with 25 additions and 165 deletions

View File

@@ -1,10 +1,11 @@
# Web-based PowerShell + SST OpenCode terminal
# Uses pre-built OpenCode CLI from GitHub releases
# Builds OpenCode CLI from source during Docker build
FROM ubuntu:24.04
ARG PWSH_VERSION=7.4.6
ARG NODE_VERSION=20.18.1
ARG TTYD_VERSION=1.7.7
ARG BUN_VERSION=1.3.8
ENV DEBIAN_FRONTEND=noninteractive \
TERM=xterm-256color \
@@ -23,6 +24,7 @@ RUN apt-get update \
tini \
libicu-dev \
libssl-dev \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js
@@ -33,6 +35,10 @@ RUN curl -fsSL -o /tmp/node.tar.xz \
&& ln -sf /usr/local/bin/npm /usr/bin/npm \
&& rm -f /tmp/node.tar.xz
# Install Bun
RUN npm install -g bun@${BUN_VERSION} \
&& bun --version
# Install PowerShell
RUN curl -fsSL -o /tmp/powershell.tar.gz \
"https://github.com/PowerShell/PowerShell/releases/download/v${PWSH_VERSION}/powershell-${PWSH_VERSION}-linux-x64.tar.gz" \
@@ -47,10 +53,20 @@ RUN curl -fsSL -o /usr/local/bin/ttyd \
"https://github.com/tsl0922/ttyd/releases/download/${TTYD_VERSION}/ttyd.x86_64" \
&& chmod +x /usr/local/bin/ttyd
# Download OpenCode CLI from GitHub releases
# This will download the latest release - requires the release to exist first
RUN curl -fsSL -L -o /usr/local/bin/opencode \
"https://github.com/southseact-3d/shopify-ai-backup/releases/latest/download/opencode-linux-x64" \
# Build OpenCode CLI from source
COPY opencode /opt/opencode-src
WORKDIR /opt/opencode-src
# Configure git for any workspace dependencies that use git URLs
RUN git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
# Install dependencies and build OpenCode CLI
ENV HUSKY=0
RUN bun install 2>&1 \
&& bun run ./packages/opencode/script/build.ts --single
# Copy the built binary to /usr/local/bin
RUN cp /opt/opencode-src/packages/opencode/dist/opencode-linux-x64/bin/opencode /usr/local/bin/opencode \
&& chmod +x /usr/local/bin/opencode \
&& opencode --version