-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (43 loc) · 2.15 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (43 loc) · 2.15 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
# syntax=docker/dockerfile:1.4
# OpenCode agent container image
# Used by OpenCodeAgentAdapter — command set by SandboxSpec, no entrypoint.
ARG NODE_TAG=22-slim
FROM node:${NODE_TAG}
ARG TARGETARCH
RUN apt-get update -qq && apt-get install -y --no-install-recommends git findutils tree jq curl ca-certificates unzip && \
rm -rf /var/lib/apt/lists/*
ARG OPENCODE_VERSION=1.2.26
RUN npm install -g opencode-ai@${OPENCODE_VERSION} && \
npm cache clean --force && \
mkdir -p /home/agent /workspace && \
chown -R 1000:1000 /home/agent /workspace
# Bun runtime for precomputation scripts (static analysis before agent runs)
ARG BUN_VERSION=1.3.11
RUN arch="${TARGETARCH:-$(dpkg --print-architecture)}" && \
case "${arch}" in \
amd64|x86_64) bun_arch="x64"; bun_sha256="8611ba935af886f05a6f38740a15160326c15e5d5d07adef966130b4493607ed" ;; \
arm64|aarch64) bun_arch="aarch64"; bun_sha256="d13944da12a53ecc74bf6a720bd1d04c4555c038dfe422365356a7be47691fdf" ;; \
*) echo "Unsupported TARGETARCH/architecture: ${arch}" >&2; exit 1 ;; \
esac && \
curl --fail --show-error --silent --location --retry 3 --retry-delay 2 \
"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 -o /tmp/bun.zip -d /tmp && \
mv "/tmp/bun-linux-${bun_arch}/bun" /usr/local/bin/bun && \
chmod +x /usr/local/bin/bun && \
rm -rf /tmp/bun*
# Precompute runner + shared libraries (practice scripts injected at runtime from DB)
COPY --chown=1000:1000 precompute/runner.ts /opt/precompute/runner.ts
COPY --chown=1000:1000 precompute/lib/ /opt/precompute/lib/
# Git security baseline: neutralize common hooks/external-command vectors in the image.
# Runtime env-based git config in DockerSandboxAdapter provides the hard override layer.
RUN git config --system core.hooksPath /nonexistent && \
git config --system core.fsmonitor false && \
git config --system safe.directory /workspace/repo
ENV HOME=/home/agent
ENV GIT_PAGER=cat
ENV GIT_TERMINAL_PROMPT=0
ENV LANG=C.UTF-8
USER 1000:1000
WORKDIR /workspace