6262fi
6363EOF
6464
65- chown -Rh bun:bun "$(echo ~bun)"
66-
6765FOE
6866
6967COPY --chmod=0555 entrypoint.sh /entrypoint.sh
7068
7169ARG OPENCODE_VERSION=latest
70+ ARG AZURE_FOUNDRY_PROVIDER_VERSION=0.2.0
71+ ARG ENGRAM_VERSION=v1.9.1
72+
7273ENV OPENCODE_CONFIG_DIR=/etc/opencode
74+ ENV OPENCODE_EXPERIMENTAL=1
75+ ENV ENGRAM_DATA_DIR=/home/bun/.local/share/opencode/engram
7376
7477# hadolint ignore=DL3003,SC2164
7578RUN <<'FOE'
7679
7780export BUN_INSTALL=/usr/local/bun
7881export PROVIDER_DIR=/usr/local/provider
82+ export OPENCODE_PLUGINS_DIR="${OPENCODE_CONFIG_DIR}/plugins"
7983
80- mkdir -p "${BUN_INSTALL}" "${OPENCODE_CONFIG_DIR}" "${PROVIDER_DIR}"
84+ mkdir -p "${BUN_INSTALL}" "${OPENCODE_CONFIG_DIR}" "${OPENCODE_PLUGINS_DIR}" "${PROVIDER_DIR}"
85+ chmod 0777 "${OPENCODE_CONFIG_DIR}"
8186
8287bun install -g "opencode-ai@${OPENCODE_VERSION}" || exit 1
8388
@@ -86,31 +91,38 @@ bun install -g "opencode-ai@${OPENCODE_VERSION}" || exit 1
8691#
8792pushd /tmp
8893
89- bun install "github:ophiosdev/azure-foundry-provider" || exit 1
94+ bun install "github:ophiosdev/azure-foundry-provider#v${AZURE_FOUNDRY_PROVIDER_VERSION} " || exit 1
9095cd node_modules/azure-foundry-provider || exit 1
9196bun build --outdir=dist src/index.ts || exit 1
9297mv dist "${PROVIDER_DIR}/azure-foundry-provider"
9398rm -rf /tmp/*
9499
95100popd || exit 1
96101
102+ engram_version="${ENGRAM_VERSION#v}"
103+ engram_archive="engram_${engram_version}_linux_amd64.tar.gz"
104+ engram_url="https://github.com/Gentleman-Programming/engram/releases/download/${ENGRAM_VERSION}/${engram_archive}"
105+ curl -fsSL "${engram_url}" | tar -C /usr/local/bin -xvzf - engram
106+ curl -fsSL 'https://raw.githubusercontent.com/Gentleman-Programming/engram/refs/tags/${ENGRAM_VERSION}/plugin/opencode/engram.ts' -o "${OPENCODE_PLUGINS_DIR}/engram.ts"
107+
108+
97109rm -rf /root/.bun
98110
111+ chown -Rh bun:bun "$(echo ~bun)"
112+
99113FOE
100114
101- USER bun
115+ USER bun:bun
102116
103117RUN mise use -g --silent python@3.12.12 go@1.24 ripgrep uv
104118
105119# hadolint ignore=DL3045
106120COPY --chown=bun:bun git-export.py git-export.py
107121
108- ENV XDG_CONFIG_HOME=/home/bun/.config
109-
110122RUN <<'FOE'
111123 source /etc/bash.bashrc
112124
113- skills_dir="${XDG_CONFIG_HOME}/opencode /skills"
125+ skills_dir="${OPENCODE_CONFIG_DIR} /skills"
114126 mkdir -p "${skills_dir}"
115127
116128 skill_name="humanizer"
@@ -126,8 +138,49 @@ RUN <<'FOE'
126138 python git-export.py https://github.com/sickn33/antigravity-awesome-skills/skills/changelog-automation "${skills_dir}/${skill_name}" --force
127139
128140 rm -f git-export.py
141+
142+ cat >"${OPENCODE_CONFIG_DIR}/opencode.json" <<-'EOF'
143+ {
144+ "$schema" : "https://opencode.ai/config.json" ,
145+ "plugin" : [
146+ "engram"
147+ ],
148+ "mcp" : {
149+ "engram" : {
150+ "command" : [
151+ "engram" ,
152+ "mcp" ,
153+ "--tools=agent"
154+ ],
155+ "enabled" : true,
156+ "type" : "local"
157+ },
158+ "sequential-thinking" : {
159+ "type" : "local" ,
160+ "command" : [
161+ "bun" ,
162+ "x" ,
163+ "@modelcontextprotocol/server-sequential-thinking"
164+ ]
165+ },
166+ "aleph" : {
167+ "type" : "local" ,
168+ "command" : [
169+ "aleph" ,
170+ "--enable-actions" ,
171+ "--workspace-mode" ,
172+ "any" ,
173+ "--tool-docs" ,
174+ "concise"
175+ ]
176+ }
177+ }
178+ }
179+ EOF
180+
129181FOE
130182
183+
131184# Set BASH_ENV so non-interactive bash shells (spawned by OpenCode CLI) source /etc/bash.bashrc
132185# This ensures mise activation and PATH are available in shell commands
133186ENV BASH_ENV=/etc/bash.bashrc
0 commit comments