mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 08:06:19 +00:00
Expose the official Responses WebSocket endpoint so Codex can retry interrupted turns without proxy-side response splicing. Preserve upstream frames under backpressure, report pump exit reasons, organize Responses handlers by transport, and poll fingerprint updates daily. Keep the warning policy in the backend manifest instead of a repository-wide Cargo config. Co-authored-by: Codex <noreply@openai.com>
87 lines
3.0 KiB
Docker
87 lines
3.0 KiB
Docker
# syntax=docker/dockerfile:1.7@sha256:a57df69d0ea827fb7266491f2813635de6f17269be881f696fbfdf2d83dda33e
|
|
|
|
FROM node:24-bookworm-slim@sha256:cb4e8f7c443347358b7875e717c29e27bf9befc8f5a26cf18af3c3dec80e58c5 AS frontend-builder
|
|
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package.json frontend/pnpm-lock.yaml frontend/pnpm-workspace.yaml ./
|
|
RUN corepack enable && pnpm install --frozen-lockfile
|
|
COPY frontend ./
|
|
RUN pnpm build
|
|
|
|
FROM rust:1.97-bookworm@sha256:7d0723df719e7f213b69dc7c8c595985c3f4b060cfbee4f7bc0e347a86fe3b6a AS backend-builder
|
|
|
|
WORKDIR /app/backend
|
|
ARG TARGETARCH
|
|
ARG CPR_VERSION=
|
|
ARG CPR_GIT_SHA=unknown
|
|
ARG CPR_BUILD_TIME=unknown
|
|
ARG CPR_BUILD_TYPE=release
|
|
ENV CARGO_TARGET_DIR=/app/backend/target/${TARGETARCH}
|
|
ENV CPR_VERSION=${CPR_VERSION}
|
|
ENV CPR_GIT_SHA=${CPR_GIT_SHA}
|
|
ENV CPR_BUILD_TIME=${CPR_BUILD_TIME}
|
|
ENV CPR_BUILD_TYPE=${CPR_BUILD_TYPE}
|
|
COPY backend/Cargo.toml backend/Cargo.lock ./
|
|
COPY backend/build.rs ./build.rs
|
|
COPY backend/src ./src
|
|
COPY release/version.yaml /app/release/version.yaml
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
--mount=type=cache,target=/usr/local/cargo/git \
|
|
--mount=type=cache,target=/app/backend/target \
|
|
cargo build --release --locked --bin codex-proxy-rs \
|
|
&& cp "${CARGO_TARGET_DIR}/release/codex-proxy-rs" /tmp/codex-proxy-rs
|
|
|
|
FROM backend-builder AS release-asset-builder
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
|
|
WORKDIR /out
|
|
COPY --from=frontend-builder /app/frontend/dist /tmp/release/codex-proxy-rs/web/dist
|
|
RUN test -n "${CPR_VERSION}" \
|
|
&& test -n "${TARGETOS}" \
|
|
&& test -n "${TARGETARCH}" \
|
|
&& cp /tmp/codex-proxy-rs /tmp/release/codex-proxy-rs/ \
|
|
&& tar -czf "/out/codex-proxy-rs_${CPR_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz" \
|
|
-C /tmp/release codex-proxy-rs
|
|
|
|
FROM scratch AS release-asset
|
|
|
|
COPY --from=release-asset-builder /out /
|
|
|
|
FROM debian:bookworm-slim@sha256:60eac759739651111db372c07be67863818726f754804b8707c90979bda511df AS runtime-base
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates curl \
|
|
&& groupadd --system --gid 10001 cpr \
|
|
&& useradd --system --uid 10001 --gid cpr --home-dir /app --shell /usr/sbin/nologin cpr \
|
|
&& install -d -o cpr -g cpr /app/bin /app/data /app/logs /app/web \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
ENV CPR_DEPLOYMENT_MODE=docker
|
|
ENV PATH="/app/bin:${PATH}"
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD curl -fsS http://127.0.0.1:8080/healthz || exit 1
|
|
|
|
CMD ["/app/bin/codex-proxy-rs"]
|
|
|
|
FROM runtime-base AS runtime
|
|
|
|
COPY --from=backend-builder --chown=cpr:cpr /tmp/codex-proxy-rs /app/bin/codex-proxy-rs
|
|
COPY --from=frontend-builder --chown=cpr:cpr /app/frontend/dist ./web/dist
|
|
USER cpr
|
|
|
|
FROM runtime-base AS runtime-prebuilt
|
|
|
|
ARG TARGETARCH
|
|
ARG CPR_PREBUILT_DIR=dist/docker
|
|
|
|
COPY --chown=cpr:cpr ${CPR_PREBUILT_DIR}/linux-${TARGETARCH}/codex-proxy-rs /app/bin/codex-proxy-rs
|
|
COPY --chown=cpr:cpr ${CPR_PREBUILT_DIR}/web/dist ./web/dist
|
|
RUN chmod +x /app/bin/codex-proxy-rs
|
|
USER cpr
|