build(docker): fix agent image build
Agent CI/CD / docker-image (push) Successful in 2m3s
Agent CI/CD / deploy-fallback-log (push) Has been skipped

This commit is contained in:
2026-06-07 17:53:19 +08:00
parent 5020e58b7e
commit 741e39b444
3 changed files with 16 additions and 5 deletions
-1
View File
@@ -1,5 +1,4 @@
.git
.gitignore
node_modules
.opencode/node_modules
.local.env
+5 -4
View File
@@ -15,10 +15,10 @@ RUN sed -i "s|http://archive.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g; s|http:/
sed -i "s|http://archive.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g; s|http://security.ubuntu.com|https://${UBUNTU_APT_MIRROR}|g" /etc/apt/sources.list.d/*.sources 2>/dev/null || true && \
apt-get update && apt-get install -y --no-install-recommends \
curl \
jq \
unzip \
python3 \
python3-venv && \
jq && \
curl -LsSf https://astral.sh/uv/install.sh | sh && \
ln -s /root/.local/bin/uv /usr/local/bin/uv && \
ln -sf /usr/bin/python3 /usr/local/bin/python && \
@@ -52,7 +52,9 @@ RUN bun install --frozen-lockfile
FROM base AS build
WORKDIR /app
COPY tsconfig.json opencode.json README.md ./
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/.opencode/node_modules ./.opencode/node_modules
COPY tsconfig.json opencode.json README.md .gitignore ./
COPY src ./src
COPY .opencode ./.opencode
RUN bun run check
@@ -67,7 +69,7 @@ ENV PORT=8787
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/.opencode/node_modules ./.opencode/node_modules
COPY package.json bun.lock ./
COPY tsconfig.json opencode.json ./
COPY tsconfig.json opencode.json .gitignore ./
COPY src ./src
COPY .opencode ./.opencode
@@ -75,7 +77,6 @@ COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
COPY .opencode ./.opencode
EXPOSE 8787
CMD ["bun", "src/server.ts"]
+11
View File
@@ -167,6 +167,7 @@ export class OpencodeRuntimeAdapter {
"starting opencode server in embedded mode",
);
const startedAt = Date.now();
let runtime;
try {
runtime = await createOpencode({
@@ -186,6 +187,16 @@ export class OpencodeRuntimeAdapter {
throw error;
}
logger.info(
{
elapsedMs: Math.max(0, Date.now() - startedAt),
hostname: config.OPENCODE_HOSTNAME,
port: config.OPENCODE_PORT,
mode: config.OPENCODE_MODE,
},
"opencode server started in embedded mode",
);
this.closeServer = () => {
runtime.server.close();
};