-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
153 lines (130 loc) · 4.92 KB
/
Copy pathDockerfile
File metadata and controls
153 lines (130 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# syntax=docker/dockerfile:1
# ============================================
# Base stage
# ============================================
FROM node:26-trixie-slim@sha256:715e55e4b84e4bb0ff48e49b398a848f08e55daed8eb6a0ea1839ae53bc57583 AS base
# renovate: datasource=npm depName=bun
ARG BUN_VERSION=1.3.14
ARG BUN_SHA256_AMD64=951ee2aee855f08595aeec6225226a298d3fea83a3dcd6465c09cbccdf7e848f
ARG BUN_SHA256_ARM64=a27ffb63a8310375836e0d6f668ae17fa8d8d18b88c37c821c65331973a19a3b
# Install common agent tools / dev dependencies + gosu for privilege dropping
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
curl \
dnsutils \
git \
gosu \
htop \
jq \
less \
libssl-dev \
openssh-client \
pkg-config \
procps \
python3 \
ripgrep \
tree \
unzip \
wget \
zip && \
rm -rf /var/lib/apt/lists/*
# Install common LSP servers and tools
RUN npm install -g \
bash-language-server \
yaml-language-server \
dockerfile-language-server-nodejs \
prettier && \
npm cache clean --force
# Install Mise for managing runtime devtools
ENV MISE_DATA_DIR=/mise
ENV MISE_CACHE_DIR=/mise/cache
ENV MISE_INSTALL_PATH=/usr/local/bin/mise
ENV MISE_TRUSTED_CONFIG_PATHS="/"
ENV PATH="/mise/shims:${PATH}"
RUN curl -fsSL https://mise.run | sh
# Install Bun for plugin auto-install
ARG TARGETARCH
ARG BUN_VERSION
ARG BUN_SHA256_AMD64
ARG BUN_SHA256_ARM64
RUN set -eux; \
case "${TARGETARCH}" in \
amd64) BUN_ARCH="x64"; BUN_SHA256="${BUN_SHA256_AMD64}" ;; \
arm64) BUN_ARCH="aarch64"; BUN_SHA256="${BUN_SHA256_ARM64}" ;; \
*) echo "Unsupported architecture: ${TARGETARCH}"; exit 1 ;; \
esac; \
curl -fsSL "https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-${BUN_ARCH}.zip" \
-o /tmp/bun.zip; \
echo "${BUN_SHA256} /tmp/bun.zip" | sha256sum -c; \
unzip -q -o /tmp/bun.zip -d /tmp/bun-extract; \
cp "/tmp/bun-extract/bun-linux-${BUN_ARCH}/bun" /usr/local/bin/bun; \
chmod +x /usr/local/bin/bun; \
rm -rf /tmp/bun.zip /tmp/bun-extract; \
bun --version
# ============================================
# Create unified system user
# ============================================
RUN userdel -r node && \
groupadd -g 1000 opencode && \
useradd -m -u 1000 -g 1000 -s /bin/bash opencode && \
mkdir -p /workspace /mise /secrets/ssh && \
ln -s /workspace /home/opencode/workspace && \
chown -R 1000:1000 /workspace /mise /home/opencode /secrets
COPY --chmod=+x entrypoint.sh /usr/local/bin/entrypoint.sh
ENV SYSTEM_USER=opencode
# ============================================
# Global build arguments
# ============================================
# renovate: datasource=npm depName=opencode-ai
ARG OPENCODE_VERSION=1.18.4
ARG OPENCODE_SHA256=6060f03c1c45afcd901a05fdd8eae60b7e82c7113ffa092792be30d6e8117eda
# ============================================
# Stage: OpenCode
# ============================================
FROM base AS opencode
ENV APP=opencode
ARG OPENCODE_VERSION
ARG OPENCODE_SHA256
# Install OpenCode
RUN set -eux; \
curl -fsSL "https://registry.npmjs.org/opencode-ai/-/opencode-ai-${OPENCODE_VERSION}.tgz" -o /tmp/opencode-ai.tgz; \
echo "${OPENCODE_SHA256} /tmp/opencode-ai.tgz" | sha256sum -c; \
npm install -g /tmp/opencode-ai.tgz && \
rm /tmp/opencode-ai.tgz && \
npm cache clean --force
EXPOSE 4096
WORKDIR /workspace
VOLUME ["/home/opencode/.config/opencode", "/home/opencode/.local/share/opencode", "/mise"]
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["opencode", "serve", "--hostname", "0.0.0.0", "--port", "4096", "--print-logs"]
# ============================================
# Stage: OpenChamber
# ============================================
FROM base AS openchamber
ENV APP=openchamber
ARG OPENCODE_VERSION
ARG OPENCODE_SHA256
# Install OpenCode (whose CLI is required by OpenChamber)
RUN set -eux; \
curl -fsSL "https://registry.npmjs.org/opencode-ai/-/opencode-ai-${OPENCODE_VERSION}.tgz" -o /tmp/opencode-ai.tgz; \
echo "${OPENCODE_SHA256} /tmp/opencode-ai.tgz" | sha256sum -c; \
npm install -g /tmp/opencode-ai.tgz && \
rm /tmp/opencode-ai.tgz && \
npm cache clean --force
# Install OpenChamber
# renovate: datasource=npm depName=@openchamber/web
ARG OPENCHAMBER_VERSION=1.16.3
ARG OPENCHAMBER_SHA256=5f33a964b6d905523f2489bfaf42463726e26b23e23b08dd9bfceef82f08aa34
RUN set -eux; \
curl -fsSL "https://registry.npmjs.org/@openchamber/web/-/web-${OPENCHAMBER_VERSION}.tgz" -o /tmp/openchamber-web.tgz; \
echo "${OPENCHAMBER_SHA256} /tmp/openchamber-web.tgz" | sha256sum -c; \
npm install -g /tmp/openchamber-web.tgz && \
rm /tmp/openchamber-web.tgz && \
npm cache clean --force
EXPOSE 3000
WORKDIR /workspace
VOLUME ["/home/opencode/.config/openchamber", "/mise"]
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["openchamber", "serve", "--foreground", "--port", "3000", "--host", "0.0.0.0"]