@opencode-cloud/core 1.0.7 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +39 -32
- package/README.md +17 -0
- package/package.json +1 -1
- package/src/config/mod.rs +8 -3
- package/src/config/paths.rs +14 -0
- package/src/config/schema.rs +470 -0
- package/src/config/validation.rs +271 -0
- package/src/docker/Dockerfile +278 -153
- package/src/docker/client.rs +132 -3
- package/src/docker/container.rs +90 -33
- package/src/docker/exec.rs +278 -0
- package/src/docker/health.rs +165 -0
- package/src/docker/image.rs +2 -4
- package/src/docker/mod.rs +47 -4
- package/src/docker/progress.rs +4 -4
- package/src/docker/update.rs +156 -0
- package/src/docker/users.rs +357 -0
- package/src/docker/version.rs +95 -0
- package/src/host/error.rs +61 -0
- package/src/host/mod.rs +29 -0
- package/src/host/provision.rs +394 -0
- package/src/host/schema.rs +308 -0
- package/src/host/ssh_config.rs +282 -0
- package/src/host/storage.rs +118 -0
- package/src/host/tunnel.rs +268 -0
- package/src/lib.rs +10 -1
- package/src/platform/launchd.rs +1 -1
- package/src/platform/systemd.rs +6 -6
- package/src/singleton/mod.rs +1 -1
- package/src/version.rs +1 -6
package/src/docker/Dockerfile
CHANGED
|
@@ -16,6 +16,19 @@
|
|
|
16
16
|
#
|
|
17
17
|
# =============================================================================
|
|
18
18
|
|
|
19
|
+
# -----------------------------------------------------------------------------
|
|
20
|
+
# Version Pinning Policy
|
|
21
|
+
# -----------------------------------------------------------------------------
|
|
22
|
+
# - APT packages: Use major.minor.* wildcards for patch updates
|
|
23
|
+
# - GitHub tools: Pin to release tags (vX.Y.Z)
|
|
24
|
+
# - Cargo/Go: Pin to exact versions (@X.Y.Z)
|
|
25
|
+
# - Security exceptions marked with: # UNPINNED: package - reason
|
|
26
|
+
# - Self-managing installers (mise, rustup, etc.) trusted to handle versions
|
|
27
|
+
#
|
|
28
|
+
# To check for updates: just check-updates
|
|
29
|
+
# Last version audit: 2026-01-22
|
|
30
|
+
# -----------------------------------------------------------------------------
|
|
31
|
+
|
|
19
32
|
# -----------------------------------------------------------------------------
|
|
20
33
|
# Stage 1: Builder
|
|
21
34
|
# -----------------------------------------------------------------------------
|
|
@@ -26,12 +39,13 @@ FROM ubuntu:24.04 AS builder
|
|
|
26
39
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
27
40
|
ENV TZ=UTC
|
|
28
41
|
|
|
29
|
-
# Install build essentials
|
|
42
|
+
# Install build essentials (2026-01-22)
|
|
30
43
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
31
|
-
build-essential \
|
|
44
|
+
build-essential=12.* \
|
|
45
|
+
# UNPINNED: ca-certificates - security-critical root certs, needs auto-updates
|
|
32
46
|
ca-certificates \
|
|
33
|
-
curl \
|
|
34
|
-
git \
|
|
47
|
+
curl=8.5.* \
|
|
48
|
+
git=1:2.43.* \
|
|
35
49
|
&& rm -rf /var/lib/apt/lists/*
|
|
36
50
|
|
|
37
51
|
# -----------------------------------------------------------------------------
|
|
@@ -39,6 +53,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
39
53
|
# -----------------------------------------------------------------------------
|
|
40
54
|
FROM ubuntu:24.04 AS runtime
|
|
41
55
|
|
|
56
|
+
# Version passed at build time (must be after FROM to be available in this stage)
|
|
57
|
+
# Default "dev" for local builds; CI sets actual version via --build-arg
|
|
58
|
+
ARG OPENCODE_CLOUD_VERSION=dev
|
|
59
|
+
|
|
42
60
|
# OCI Labels for image metadata
|
|
43
61
|
LABEL org.opencontainers.image.title="opencode-cloud"
|
|
44
62
|
LABEL org.opencontainers.image.description="AI-assisted development environment with opencode"
|
|
@@ -47,6 +65,8 @@ LABEL org.opencontainers.image.source="https://github.com/pRizz/opencode-cloud"
|
|
|
47
65
|
LABEL org.opencontainers.image.vendor="pRizz"
|
|
48
66
|
LABEL org.opencontainers.image.licenses="MIT"
|
|
49
67
|
LABEL org.opencontainers.image.base.name="ubuntu:24.04"
|
|
68
|
+
# Version label for CLI compatibility checks (set via --build-arg OPENCODE_CLOUD_VERSION)
|
|
69
|
+
LABEL org.opencode-cloud.version="${OPENCODE_CLOUD_VERSION}"
|
|
50
70
|
|
|
51
71
|
# Environment configuration
|
|
52
72
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
@@ -59,70 +79,85 @@ ENV LC_ALL=C.UTF-8
|
|
|
59
79
|
# -----------------------------------------------------------------------------
|
|
60
80
|
# Install core system packages in logical groups for better caching
|
|
61
81
|
|
|
62
|
-
# Group 1: Core utilities and build tools
|
|
82
|
+
# Group 1: Core utilities and build tools (2026-01-22)
|
|
63
83
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
64
|
-
#
|
|
65
|
-
tini \
|
|
66
|
-
dumb-init \
|
|
84
|
+
# Init systems
|
|
85
|
+
tini=0.19.* \
|
|
86
|
+
dumb-init=1.2.* \
|
|
87
|
+
# systemd for Cockpit support
|
|
88
|
+
systemd=255.* \
|
|
89
|
+
systemd-sysv=255.* \
|
|
90
|
+
dbus=1.14.* \
|
|
67
91
|
# Shell and terminal
|
|
68
|
-
zsh \
|
|
69
|
-
tmux \
|
|
92
|
+
zsh=5.9-* \
|
|
93
|
+
tmux=3.4-* \
|
|
70
94
|
# Editors
|
|
71
|
-
vim \
|
|
72
|
-
neovim \
|
|
73
|
-
nano \
|
|
95
|
+
vim=2:9.1.* \
|
|
96
|
+
neovim=0.9.* \
|
|
97
|
+
nano=7.2-* \
|
|
74
98
|
# Build essentials
|
|
75
|
-
build-essential \
|
|
76
|
-
pkg-config \
|
|
77
|
-
cmake \
|
|
99
|
+
build-essential=12.* \
|
|
100
|
+
pkg-config=1.8.* \
|
|
101
|
+
cmake=3.28.* \
|
|
78
102
|
# Version control
|
|
79
|
-
git \
|
|
80
|
-
git-lfs \
|
|
103
|
+
git=1:2.43.* \
|
|
104
|
+
git-lfs=3.4.* \
|
|
81
105
|
# Core utilities
|
|
82
|
-
curl \
|
|
83
|
-
wget \
|
|
106
|
+
curl=8.5.* \
|
|
107
|
+
wget=1.21.* \
|
|
108
|
+
# UNPINNED: ca-certificates - security-critical root certs, needs auto-updates
|
|
84
109
|
ca-certificates \
|
|
110
|
+
# UNPINNED: gnupg - key management security, needs auto-updates
|
|
85
111
|
gnupg \
|
|
86
|
-
lsb-release \
|
|
87
|
-
software-properties-common \
|
|
88
|
-
sudo \
|
|
112
|
+
lsb-release=12.* \
|
|
113
|
+
software-properties-common=0.99.* \
|
|
114
|
+
sudo=1.9.* \
|
|
115
|
+
# UNPINNED: openssh-client - security-critical, needs auto-updates
|
|
89
116
|
openssh-client \
|
|
90
117
|
# Process/system tools
|
|
91
|
-
htop \
|
|
92
|
-
procps \
|
|
93
|
-
less \
|
|
94
|
-
file \
|
|
95
|
-
tree \
|
|
118
|
+
htop=3.3.* \
|
|
119
|
+
procps=2:4.0.* \
|
|
120
|
+
less=590-* \
|
|
121
|
+
file=1:5.45-* \
|
|
122
|
+
tree=2.1.* \
|
|
96
123
|
# JSON/YAML processing
|
|
97
|
-
jq \
|
|
124
|
+
jq=1.7.* \
|
|
98
125
|
# Network tools
|
|
99
|
-
netcat-openbsd \
|
|
100
|
-
iputils-ping \
|
|
101
|
-
dnsutils \
|
|
126
|
+
netcat-openbsd=1.226-* \
|
|
127
|
+
iputils-ping=3:20240117-* \
|
|
128
|
+
dnsutils=1:9.18.* \
|
|
102
129
|
# Compression
|
|
103
|
-
zip \
|
|
104
|
-
unzip \
|
|
105
|
-
xz-utils \
|
|
106
|
-
p7zip-full \
|
|
130
|
+
zip=3.0-* \
|
|
131
|
+
unzip=6.0-* \
|
|
132
|
+
xz-utils=5.6.* \
|
|
133
|
+
p7zip-full=16.02* \
|
|
107
134
|
&& rm -rf /var/lib/apt/lists/*
|
|
108
135
|
|
|
109
|
-
#
|
|
136
|
+
# Mask unnecessary systemd services for container environment
|
|
137
|
+
RUN systemctl mask \
|
|
138
|
+
dev-hugepages.mount \
|
|
139
|
+
sys-fs-fuse-connections.mount \
|
|
140
|
+
systemd-update-utmp.service \
|
|
141
|
+
systemd-tmpfiles-setup.service \
|
|
142
|
+
systemd-remount-fs.service
|
|
143
|
+
|
|
144
|
+
# Group 2: Database clients (2026-01-22)
|
|
110
145
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
111
|
-
sqlite3 \
|
|
112
|
-
postgresql-client \
|
|
113
|
-
default-mysql-client \
|
|
146
|
+
sqlite3=3.45.* \
|
|
147
|
+
postgresql-client=16+* \
|
|
148
|
+
default-mysql-client=1.1.* \
|
|
114
149
|
&& rm -rf /var/lib/apt/lists/*
|
|
115
150
|
|
|
116
|
-
# Group 3: Development libraries
|
|
151
|
+
# Group 3: Development libraries for compiling tools (2026-01-22)
|
|
117
152
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
118
|
-
libssl-dev \
|
|
119
|
-
libffi-dev \
|
|
120
|
-
zlib1g-dev \
|
|
121
|
-
libbz2-dev \
|
|
122
|
-
libreadline-dev \
|
|
123
|
-
libsqlite3-dev \
|
|
124
|
-
libncurses-dev \
|
|
125
|
-
liblzma-dev \
|
|
153
|
+
libssl-dev=3.0.* \
|
|
154
|
+
libffi-dev=3.4.* \
|
|
155
|
+
zlib1g-dev=1:1.3.* \
|
|
156
|
+
libbz2-dev=1.0.* \
|
|
157
|
+
libreadline-dev=8.2-* \
|
|
158
|
+
libsqlite3-dev=3.45.* \
|
|
159
|
+
libncurses-dev=6.4+* \
|
|
160
|
+
liblzma-dev=5.6.* \
|
|
126
161
|
&& rm -rf /var/lib/apt/lists/*
|
|
127
162
|
|
|
128
163
|
# -----------------------------------------------------------------------------
|
|
@@ -151,10 +186,10 @@ ENV PATH="/home/opencode/.local/bin:${PATH}"
|
|
|
151
186
|
# -----------------------------------------------------------------------------
|
|
152
187
|
# Shell Setup: Zsh + Oh My Zsh + Starship
|
|
153
188
|
# -----------------------------------------------------------------------------
|
|
154
|
-
#
|
|
189
|
+
# Oh My Zsh - self-managing installer, trusted to handle versions
|
|
155
190
|
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
|
156
191
|
|
|
157
|
-
#
|
|
192
|
+
# Starship prompt - self-managing installer, trusted to handle versions
|
|
158
193
|
RUN curl -sS https://starship.rs/install.sh | sh -s -- --yes --bin-dir /home/opencode/.local/bin
|
|
159
194
|
|
|
160
195
|
# Configure zsh with starship
|
|
@@ -164,18 +199,20 @@ RUN echo 'eval "$(starship init zsh)"' >> /home/opencode/.zshrc \
|
|
|
164
199
|
# -----------------------------------------------------------------------------
|
|
165
200
|
# mise: Universal Version Manager
|
|
166
201
|
# -----------------------------------------------------------------------------
|
|
167
|
-
#
|
|
202
|
+
# mise - self-managing installer, trusted to handle versions
|
|
168
203
|
RUN curl https://mise.run | sh \
|
|
169
204
|
&& echo 'eval "$(/home/opencode/.local/bin/mise activate zsh)"' >> /home/opencode/.zshrc
|
|
170
205
|
|
|
171
|
-
# Install language runtimes via mise
|
|
172
|
-
#
|
|
206
|
+
# Install language runtimes via mise (2026-01-22)
|
|
207
|
+
# - node@lts: mise handles LTS resolution (currently 22.x)
|
|
208
|
+
# - python@3.12: pinned to minor version
|
|
209
|
+
# - go@1.24: pinned to minor version (was @latest)
|
|
173
210
|
RUN /home/opencode/.local/bin/mise install node@lts \
|
|
174
211
|
&& /home/opencode/.local/bin/mise install python@3.12 \
|
|
175
|
-
&& /home/opencode/.local/bin/mise install go@
|
|
212
|
+
&& /home/opencode/.local/bin/mise install go@1.24 \
|
|
176
213
|
&& /home/opencode/.local/bin/mise use --global node@lts \
|
|
177
214
|
&& /home/opencode/.local/bin/mise use --global python@3.12 \
|
|
178
|
-
&& /home/opencode/.local/bin/mise use --global go@
|
|
215
|
+
&& /home/opencode/.local/bin/mise use --global go@1.24
|
|
179
216
|
|
|
180
217
|
# Set up mise shims in PATH for non-interactive shells
|
|
181
218
|
ENV PATH="/home/opencode/.local/share/mise/shims:${PATH}"
|
|
@@ -183,7 +220,8 @@ ENV PATH="/home/opencode/.local/share/mise/shims:${PATH}"
|
|
|
183
220
|
# -----------------------------------------------------------------------------
|
|
184
221
|
# Rust Installation
|
|
185
222
|
# -----------------------------------------------------------------------------
|
|
186
|
-
#
|
|
223
|
+
# rustup - self-managing installer, trusted to handle versions
|
|
224
|
+
# Uses stable toolchain (rustup manages toolchain versioning)
|
|
187
225
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable \
|
|
188
226
|
&& . /home/opencode/.cargo/env \
|
|
189
227
|
&& rustup component add rust-analyzer rustfmt clippy
|
|
@@ -196,17 +234,17 @@ ENV PATH="/home/opencode/.cargo/bin:${PATH}"
|
|
|
196
234
|
# Switch to bash for mise activation (mise outputs bash-specific syntax)
|
|
197
235
|
SHELL ["/bin/bash", "-c"]
|
|
198
236
|
|
|
199
|
-
# Install pnpm
|
|
237
|
+
# Install pnpm 10.x via corepack (2026-01-22)
|
|
200
238
|
RUN eval "$(/home/opencode/.local/bin/mise activate bash)" \
|
|
201
239
|
&& corepack enable \
|
|
202
|
-
&& corepack prepare pnpm@
|
|
240
|
+
&& corepack prepare pnpm@10.28.1 --activate
|
|
203
241
|
|
|
204
242
|
# Set up pnpm global bin directory
|
|
205
243
|
ENV PNPM_HOME="/home/opencode/.local/share/pnpm"
|
|
206
244
|
ENV PATH="${PNPM_HOME}:${PATH}"
|
|
207
245
|
RUN mkdir -p "${PNPM_HOME}"
|
|
208
246
|
|
|
209
|
-
#
|
|
247
|
+
# uv - self-managing installer, trusted to handle versions (fast Python package manager)
|
|
210
248
|
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
211
249
|
|
|
212
250
|
# Install pipx for isolated Python application installs
|
|
@@ -219,32 +257,31 @@ RUN eval "$(/home/opencode/.local/bin/mise activate bash)" \
|
|
|
219
257
|
&& pnpm add -g typescript
|
|
220
258
|
|
|
221
259
|
# -----------------------------------------------------------------------------
|
|
222
|
-
# Modern CLI Tools (Rust-based)
|
|
260
|
+
# Modern CLI Tools (Rust-based) - pinned versions (2026-01-22)
|
|
223
261
|
# -----------------------------------------------------------------------------
|
|
224
|
-
#
|
|
262
|
+
# ripgrep 15.1.0 - fast regex search
|
|
263
|
+
# eza 0.23.4 - modern ls replacement
|
|
225
264
|
RUN . /home/opencode/.cargo/env \
|
|
226
|
-
&& cargo install --locked
|
|
227
|
-
ripgrep \
|
|
228
|
-
eza
|
|
265
|
+
&& cargo install --locked ripgrep@15.1.0 eza@0.23.4
|
|
229
266
|
|
|
230
|
-
#
|
|
267
|
+
# lazygit v0.58.1 (2026-01-12) - terminal UI for git
|
|
231
268
|
RUN eval "$(/home/opencode/.local/bin/mise activate bash)" \
|
|
232
|
-
&& go install github.com/jesseduffield/lazygit@
|
|
269
|
+
&& go install github.com/jesseduffield/lazygit@v0.58.1
|
|
233
270
|
|
|
234
271
|
# -----------------------------------------------------------------------------
|
|
235
272
|
# Additional Development Tools
|
|
236
273
|
# -----------------------------------------------------------------------------
|
|
237
|
-
#
|
|
238
|
-
RUN git clone --depth 1 https://github.com/junegunn/fzf.git /home/opencode/.fzf \
|
|
274
|
+
# fzf v0.67.0 (2025-11-16) - fuzzy finder
|
|
275
|
+
RUN git clone --branch v0.67.0 --depth 1 https://github.com/junegunn/fzf.git /home/opencode/.fzf \
|
|
239
276
|
&& /home/opencode/.fzf/install --all --no-bash --no-fish
|
|
240
277
|
|
|
241
|
-
#
|
|
242
|
-
RUN curl -sL https://github.com/mikefarah/yq/releases/
|
|
278
|
+
# yq v4.50.1 (2025-12-14) - YAML processor
|
|
279
|
+
RUN curl -sL https://github.com/mikefarah/yq/releases/download/v4.50.1/yq_linux_$(dpkg --print-architecture) -o /home/opencode/.local/bin/yq \
|
|
243
280
|
&& chmod +x /home/opencode/.local/bin/yq
|
|
244
281
|
|
|
245
|
-
# Install direnv
|
|
282
|
+
# Install direnv (2026-01-22)
|
|
246
283
|
USER root
|
|
247
|
-
RUN apt-get update && apt-get install -y --no-install-recommends direnv \
|
|
284
|
+
RUN apt-get update && apt-get install -y --no-install-recommends direnv=2.32.* \
|
|
248
285
|
&& rm -rf /var/lib/apt/lists/*
|
|
249
286
|
USER opencode
|
|
250
287
|
RUN echo 'eval "$(direnv hook zsh)"' >> /home/opencode/.zshrc
|
|
@@ -253,17 +290,18 @@ RUN echo 'eval "$(direnv hook zsh)"' >> /home/opencode/.zshrc
|
|
|
253
290
|
RUN eval "$(/home/opencode/.local/bin/mise activate bash)" \
|
|
254
291
|
&& pipx install httpie
|
|
255
292
|
|
|
256
|
-
# Install shellcheck
|
|
293
|
+
# Install shellcheck (2026-01-22)
|
|
257
294
|
USER root
|
|
258
|
-
RUN apt-get update && apt-get install -y --no-install-recommends shellcheck \
|
|
295
|
+
RUN apt-get update && apt-get install -y --no-install-recommends shellcheck=0.9.* \
|
|
259
296
|
&& rm -rf /var/lib/apt/lists/*
|
|
260
297
|
USER opencode
|
|
298
|
+
# shfmt v3.12.0 (2025-07-06) - shell formatter
|
|
261
299
|
RUN eval "$(/home/opencode/.local/bin/mise activate bash)" \
|
|
262
|
-
&& go install mvdan.cc/sh/v3/cmd/shfmt@
|
|
300
|
+
&& go install mvdan.cc/sh/v3/cmd/shfmt@v3.12.0
|
|
263
301
|
|
|
264
|
-
# Install btop
|
|
302
|
+
# Install btop system monitor (2026-01-22)
|
|
265
303
|
USER root
|
|
266
|
-
RUN apt-get update && apt-get install -y --no-install-recommends btop \
|
|
304
|
+
RUN apt-get update && apt-get install -y --no-install-recommends btop=1.3.* \
|
|
267
305
|
&& rm -rf /var/lib/apt/lists/*
|
|
268
306
|
USER opencode
|
|
269
307
|
|
|
@@ -278,24 +316,58 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | d
|
|
|
278
316
|
&& rm -rf /var/lib/apt/lists/*
|
|
279
317
|
USER opencode
|
|
280
318
|
|
|
319
|
+
# -----------------------------------------------------------------------------
|
|
320
|
+
# Cockpit Web Console (2026-01-22)
|
|
321
|
+
# -----------------------------------------------------------------------------
|
|
322
|
+
# Cockpit provides web-based administration for the container
|
|
323
|
+
# Ubuntu noble has cockpit 316 in main repos
|
|
324
|
+
USER root
|
|
325
|
+
RUN apt-get update && \
|
|
326
|
+
apt-get install -y --no-install-recommends \
|
|
327
|
+
cockpit-ws \
|
|
328
|
+
cockpit-system \
|
|
329
|
+
cockpit-bridge \
|
|
330
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
331
|
+
|
|
332
|
+
# Enable Cockpit socket activation (manual symlink since systemctl doesn't work during build)
|
|
333
|
+
RUN mkdir -p /etc/systemd/system/sockets.target.wants \
|
|
334
|
+
&& ln -sf /lib/systemd/system/cockpit.socket /etc/systemd/system/sockets.target.wants/cockpit.socket
|
|
335
|
+
|
|
336
|
+
# Configure Cockpit for HTTP (TLS terminated externally) and proxy headers
|
|
337
|
+
RUN mkdir -p /etc/cockpit && \
|
|
338
|
+
printf '%s\n' \
|
|
339
|
+
'[WebService]' \
|
|
340
|
+
'# Allow HTTP connections (TLS terminated externally like opencode)' \
|
|
341
|
+
'AllowUnencrypted = true' \
|
|
342
|
+
'' \
|
|
343
|
+
'# Trust proxy headers for X-Forwarded-For, X-Forwarded-Proto' \
|
|
344
|
+
'ProtocolHeader = X-Forwarded-Proto' \
|
|
345
|
+
'ForwardedForHeader = X-Forwarded-For' \
|
|
346
|
+
'' \
|
|
347
|
+
'# Limit concurrent login attempts' \
|
|
348
|
+
'MaxStartups = 10' \
|
|
349
|
+
> /etc/cockpit/cockpit.conf
|
|
350
|
+
|
|
351
|
+
USER opencode
|
|
352
|
+
|
|
281
353
|
# -----------------------------------------------------------------------------
|
|
282
354
|
# CI/CD Tools
|
|
283
355
|
# -----------------------------------------------------------------------------
|
|
284
|
-
#
|
|
285
|
-
RUN curl -sL https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash -s -- -b /home/opencode/.local/bin
|
|
356
|
+
# act v0.2.84 (2026-01-01) - run GitHub Actions locally
|
|
357
|
+
RUN curl -sL https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash -s -- -b /home/opencode/.local/bin v0.2.84
|
|
286
358
|
|
|
287
359
|
# -----------------------------------------------------------------------------
|
|
288
|
-
# Rust Tooling
|
|
360
|
+
# Rust Tooling - pinned versions (2026-01-22)
|
|
289
361
|
# -----------------------------------------------------------------------------
|
|
362
|
+
# cargo-nextest 0.9.122 - fast test runner
|
|
363
|
+
# cargo-audit 0.22.0 - security audit
|
|
364
|
+
# cargo-deny 0.19.0 - dependency linter
|
|
290
365
|
RUN . /home/opencode/.cargo/env \
|
|
291
|
-
&& cargo install --locked
|
|
292
|
-
cargo-nextest \
|
|
293
|
-
cargo-audit \
|
|
294
|
-
cargo-deny
|
|
366
|
+
&& cargo install --locked cargo-nextest@0.9.122 cargo-audit@0.22.0 cargo-deny@0.19.0
|
|
295
367
|
|
|
296
|
-
# Install mold
|
|
368
|
+
# Install mold fast linker (2026-01-22)
|
|
297
369
|
USER root
|
|
298
|
-
RUN apt-get update && apt-get install -y --no-install-recommends mold \
|
|
370
|
+
RUN apt-get update && apt-get install -y --no-install-recommends mold=2.30.* \
|
|
299
371
|
&& rm -rf /var/lib/apt/lists/*
|
|
300
372
|
USER opencode
|
|
301
373
|
|
|
@@ -323,21 +395,21 @@ RUN eval "$(/home/opencode/.local/bin/mise activate bash)" \
|
|
|
323
395
|
&& pipx install pytest
|
|
324
396
|
|
|
325
397
|
# -----------------------------------------------------------------------------
|
|
326
|
-
# Protocol Buffers / gRPC
|
|
398
|
+
# Protocol Buffers / gRPC (2026-01-22)
|
|
327
399
|
# -----------------------------------------------------------------------------
|
|
328
400
|
USER root
|
|
329
|
-
RUN apt-get update && apt-get install -y --no-install-recommends protobuf-compiler \
|
|
401
|
+
RUN apt-get update && apt-get install -y --no-install-recommends protobuf-compiler=3.21.* \
|
|
330
402
|
&& rm -rf /var/lib/apt/lists/*
|
|
331
403
|
USER opencode
|
|
332
404
|
|
|
333
|
-
#
|
|
405
|
+
# grpcurl v1.9.3 (2025-03-11) - gRPC debugging tool
|
|
334
406
|
RUN eval "$(/home/opencode/.local/bin/mise activate bash)" \
|
|
335
|
-
&& go install github.com/fullstorydev/grpcurl/cmd/grpcurl@
|
|
407
|
+
&& go install github.com/fullstorydev/grpcurl/cmd/grpcurl@v1.9.3
|
|
336
408
|
|
|
337
409
|
# -----------------------------------------------------------------------------
|
|
338
410
|
# opencode Installation
|
|
339
411
|
# -----------------------------------------------------------------------------
|
|
340
|
-
#
|
|
412
|
+
# opencode - self-managing installer, trusted to handle versions
|
|
341
413
|
# The script installs to ~/.opencode/bin/
|
|
342
414
|
RUN curl -fsSL https://opencode.ai/install | bash \
|
|
343
415
|
&& ls -la /home/opencode/.opencode/bin/opencode \
|
|
@@ -352,6 +424,35 @@ ENV PATH="/home/opencode/.opencode/bin:${PATH}"
|
|
|
352
424
|
# Install the GSD (Get Shit Done) plugin for opencode
|
|
353
425
|
RUN git clone https://github.com/rokicool/gsd-opencode.git /home/opencode/.config/opencode/plugins/gsd-opencode
|
|
354
426
|
|
|
427
|
+
# -----------------------------------------------------------------------------
|
|
428
|
+
# opencode systemd Service (2026-01-22)
|
|
429
|
+
# -----------------------------------------------------------------------------
|
|
430
|
+
# Create opencode as a systemd service for Cockpit integration
|
|
431
|
+
USER root
|
|
432
|
+
RUN printf '%s\n' \
|
|
433
|
+
'[Unit]' \
|
|
434
|
+
'Description=opencode Web Interface' \
|
|
435
|
+
'After=network.target' \
|
|
436
|
+
'' \
|
|
437
|
+
'[Service]' \
|
|
438
|
+
'Type=simple' \
|
|
439
|
+
'User=opencode' \
|
|
440
|
+
'WorkingDirectory=/home/opencode/workspace' \
|
|
441
|
+
'ExecStart=/home/opencode/.opencode/bin/opencode web --port 3000 --hostname 0.0.0.0' \
|
|
442
|
+
'Restart=always' \
|
|
443
|
+
'RestartSec=5' \
|
|
444
|
+
'Environment=PATH=/home/opencode/.opencode/bin:/home/opencode/.local/bin:/home/opencode/.cargo/bin:/home/opencode/.local/share/mise/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' \
|
|
445
|
+
'' \
|
|
446
|
+
'[Install]' \
|
|
447
|
+
'WantedBy=multi-user.target' \
|
|
448
|
+
> /etc/systemd/system/opencode.service
|
|
449
|
+
|
|
450
|
+
# Enable opencode service to start at boot (manual symlink since systemctl doesn't work during build)
|
|
451
|
+
RUN mkdir -p /etc/systemd/system/multi-user.target.wants \
|
|
452
|
+
&& ln -sf /etc/systemd/system/opencode.service /etc/systemd/system/multi-user.target.wants/opencode.service
|
|
453
|
+
|
|
454
|
+
USER opencode
|
|
455
|
+
|
|
355
456
|
# -----------------------------------------------------------------------------
|
|
356
457
|
# Sensible Defaults Configuration
|
|
357
458
|
# -----------------------------------------------------------------------------
|
|
@@ -364,81 +465,105 @@ RUN git config --global init.defaultBranch main \
|
|
|
364
465
|
|
|
365
466
|
# Starship configuration (minimal, fast prompt)
|
|
366
467
|
RUN mkdir -p /home/opencode/.config \
|
|
367
|
-
&&
|
|
368
|
-
# Minimal starship config for fast prompt
|
|
369
|
-
format = """
|
|
370
|
-
$directory\
|
|
371
|
-
$git_branch\
|
|
372
|
-
$git_status\
|
|
373
|
-
$character"""
|
|
374
|
-
|
|
375
|
-
[directory]
|
|
376
|
-
truncation_length = 3
|
|
377
|
-
truncate_to_repo = true
|
|
378
|
-
|
|
379
|
-
[git_branch]
|
|
380
|
-
format = "[$branch]($style) "
|
|
381
|
-
style = "bold purple"
|
|
382
|
-
|
|
383
|
-
[git_status]
|
|
384
|
-
format = '([$all_status$ahead_behind]($style) )'
|
|
385
|
-
|
|
386
|
-
[character]
|
|
387
|
-
success_symbol = "[>](bold green)"
|
|
388
|
-
error_symbol = "[>](bold red)"
|
|
389
|
-
|
|
468
|
+
&& printf '%s\n' \
|
|
469
|
+
'# Minimal starship config for fast prompt' \
|
|
470
|
+
'format = """' \
|
|
471
|
+
'$directory\' \
|
|
472
|
+
'$git_branch\' \
|
|
473
|
+
'$git_status\' \
|
|
474
|
+
'$character"""' \
|
|
475
|
+
'' \
|
|
476
|
+
'[directory]' \
|
|
477
|
+
'truncation_length = 3' \
|
|
478
|
+
'truncate_to_repo = true' \
|
|
479
|
+
'' \
|
|
480
|
+
'[git_branch]' \
|
|
481
|
+
'format = "[$branch]($style) "' \
|
|
482
|
+
'style = "bold purple"' \
|
|
483
|
+
'' \
|
|
484
|
+
'[git_status]' \
|
|
485
|
+
'format = '"'"'([$all_status$ahead_behind]($style) )'"'"'' \
|
|
486
|
+
'' \
|
|
487
|
+
'[character]' \
|
|
488
|
+
'success_symbol = "[>](bold green)"' \
|
|
489
|
+
'error_symbol = "[>](bold red)"' \
|
|
490
|
+
> /home/opencode/.config/starship.toml
|
|
390
491
|
|
|
391
492
|
# Shell aliases
|
|
392
|
-
RUN
|
|
393
|
-
|
|
394
|
-
# Modern CLI aliases
|
|
395
|
-
alias ls="eza --icons"
|
|
396
|
-
alias ll="eza -l --icons"
|
|
397
|
-
alias la="eza -la --icons"
|
|
398
|
-
alias lt="eza --tree --icons"
|
|
399
|
-
alias grep="rg"
|
|
400
|
-
alias top="btop"
|
|
401
|
-
|
|
402
|
-
# Git aliases
|
|
403
|
-
alias g="git"
|
|
404
|
-
alias gs="git status"
|
|
405
|
-
alias gd="git diff"
|
|
406
|
-
alias gc="git commit"
|
|
407
|
-
alias gp="git push"
|
|
408
|
-
alias gl="git pull"
|
|
409
|
-
alias gco="git checkout"
|
|
410
|
-
alias gb="git branch"
|
|
411
|
-
alias lg="lazygit"
|
|
412
|
-
|
|
413
|
-
# Docker aliases (for Docker-in-Docker)
|
|
414
|
-
alias d="docker"
|
|
415
|
-
alias dc="docker compose"
|
|
416
|
-
|
|
417
|
-
|
|
493
|
+
RUN printf '%s\n' \
|
|
494
|
+
'' \
|
|
495
|
+
'# Modern CLI aliases' \
|
|
496
|
+
'alias ls="eza --icons"' \
|
|
497
|
+
'alias ll="eza -l --icons"' \
|
|
498
|
+
'alias la="eza -la --icons"' \
|
|
499
|
+
'alias lt="eza --tree --icons"' \
|
|
500
|
+
'alias grep="rg"' \
|
|
501
|
+
'alias top="btop"' \
|
|
502
|
+
'' \
|
|
503
|
+
'# Git aliases' \
|
|
504
|
+
'alias g="git"' \
|
|
505
|
+
'alias gs="git status"' \
|
|
506
|
+
'alias gd="git diff"' \
|
|
507
|
+
'alias gc="git commit"' \
|
|
508
|
+
'alias gp="git push"' \
|
|
509
|
+
'alias gl="git pull"' \
|
|
510
|
+
'alias gco="git checkout"' \
|
|
511
|
+
'alias gb="git branch"' \
|
|
512
|
+
'alias lg="lazygit"' \
|
|
513
|
+
'' \
|
|
514
|
+
'# Docker aliases (for Docker-in-Docker)' \
|
|
515
|
+
'alias d="docker"' \
|
|
516
|
+
'alias dc="docker compose"' \
|
|
517
|
+
'' \
|
|
518
|
+
>> /home/opencode/.zshrc
|
|
418
519
|
|
|
419
520
|
# Set up pipx path
|
|
420
521
|
RUN echo 'export PATH="/home/opencode/.local/bin:$PATH"' >> /home/opencode/.zshrc
|
|
421
522
|
|
|
523
|
+
# -----------------------------------------------------------------------------
|
|
524
|
+
# Entrypoint Script (Hybrid Init Support)
|
|
525
|
+
# -----------------------------------------------------------------------------
|
|
526
|
+
# Supports both tini (default, works everywhere) and systemd (for Cockpit on Linux)
|
|
527
|
+
# Set USE_SYSTEMD=1 environment variable to use systemd init
|
|
528
|
+
# Note: Entrypoint runs as root to support both modes; tini mode drops to opencode user
|
|
529
|
+
USER root
|
|
530
|
+
RUN printf '%s\n' \
|
|
531
|
+
'#!/bin/bash' \
|
|
532
|
+
'if [ "${USE_SYSTEMD}" = "1" ]; then' \
|
|
533
|
+
' exec /sbin/init' \
|
|
534
|
+
'else' \
|
|
535
|
+
' # Use runuser to switch to opencode user without password prompt' \
|
|
536
|
+
' exec /usr/bin/tini -- runuser -u opencode -- /home/opencode/.opencode/bin/opencode web --port 3000 --hostname 0.0.0.0' \
|
|
537
|
+
'fi' \
|
|
538
|
+
> /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
|
|
539
|
+
|
|
540
|
+
# Note: Don't set USER here - entrypoint needs root to use runuser
|
|
541
|
+
# The tini mode drops privileges to opencode user via runuser
|
|
542
|
+
|
|
422
543
|
# -----------------------------------------------------------------------------
|
|
423
544
|
# Health Check
|
|
424
545
|
# -----------------------------------------------------------------------------
|
|
425
|
-
#
|
|
426
|
-
|
|
546
|
+
# Check that opencode health endpoint responds
|
|
547
|
+
# Works for both tini and systemd modes
|
|
548
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
|
427
549
|
CMD curl -f http://localhost:3000/health || exit 1
|
|
428
550
|
|
|
551
|
+
# -----------------------------------------------------------------------------
|
|
552
|
+
# Version File
|
|
553
|
+
# -----------------------------------------------------------------------------
|
|
554
|
+
# Store version in file for runtime access (debugging, scripts)
|
|
555
|
+
USER root
|
|
556
|
+
ARG OPENCODE_CLOUD_VERSION=dev
|
|
557
|
+
RUN echo "${OPENCODE_CLOUD_VERSION}" > /etc/opencode-cloud-version
|
|
558
|
+
USER opencode
|
|
559
|
+
|
|
429
560
|
# -----------------------------------------------------------------------------
|
|
430
561
|
# Final Configuration
|
|
431
562
|
# -----------------------------------------------------------------------------
|
|
432
563
|
WORKDIR /home/opencode/workspace
|
|
433
564
|
|
|
434
|
-
# Expose opencode web port (
|
|
435
|
-
EXPOSE 3000
|
|
436
|
-
|
|
437
|
-
# Use tini as init system for proper signal handling
|
|
438
|
-
ENTRYPOINT ["/usr/bin/tini", "--"]
|
|
565
|
+
# Expose opencode web port (3000) and Cockpit port (9090)
|
|
566
|
+
EXPOSE 3000 9090
|
|
439
567
|
|
|
440
|
-
#
|
|
441
|
-
|
|
442
|
-
# - Using full path to ensure binary is found (opencode installs to ~/.opencode/bin/)
|
|
443
|
-
# - --hostname 0.0.0.0 is required for Docker port mapping (default 127.0.0.1 only listens on loopback)
|
|
444
|
-
CMD ["/home/opencode/.opencode/bin/opencode", "web", "--port", "3000", "--hostname", "0.0.0.0"]
|
|
568
|
+
# Hybrid init: entrypoint script chooses tini or systemd based on USE_SYSTEMD env
|
|
569
|
+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|