build(docker): add Codex CLI to Docker image

Install Node.js 22 and @openai/codex globally in the production Docker
image to support the Codex review engine runtime dependency.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
jeffusion
2026-03-07 00:16:17 +08:00
committed by 路遥知码力
parent ae0dfceba1
commit 272c832c43

View File

@@ -25,7 +25,22 @@ COPY src ./src
COPY tsconfig.json .
# ---- Stage 3: Production ----
# ---- Stage 3: Codex CLI Binary ----
FROM debian:bookworm-slim AS codex-downloader
ARG CODEX_VERSION=0.111.0
ARG TARGETARCH
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*
RUN ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "x86_64") && \
curl -fsSL "https://github.com/openai/codex/releases/download/rust-v${CODEX_VERSION}/codex-${ARCH}-unknown-linux-musl.tar.gz" \
| tar -xz -C /usr/local/bin/ && \
mv /usr/local/bin/codex-${ARCH}-unknown-linux-musl /usr/local/bin/codex && \
chmod +x /usr/local/bin/codex
# ---- Stage 4: Production ----
FROM oven/bun:1-slim
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates ripgrep && rm -rf /var/lib/apt/lists/*
@@ -39,6 +54,9 @@ COPY --from=backend-builder /app/tsconfig.json .
COPY --from=frontend-builder /app/frontend/dist ./public
# Codex CLI binary (statically linked musl build)
COPY --from=codex-downloader /usr/local/bin/codex /usr/local/bin/codex
EXPOSE 3000
CMD ["bun", "run", "start"]