mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 16:04:01 +00:00
Preserve request parameters, tool-call completion reasons and retry session affinity. Bound upstream header waits, stop expired-context scans and add opt-in redacted request-body diagnostics. Isolate Playground diagnostics from production pools, report stream failures accurately, align readiness with discoverable models and honor Docker listen configuration. Split Go and WebUI modules by responsibility, add regression tests and CI, standardize formatting and rewrite the English and Chinese READMEs. Refs: #6, #18, #19, #20, #21, #22, #23, #24, #25
50 lines
1.4 KiB
Docker
50 lines
1.4 KiB
Docker
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
ARG VERSION=dev
|
|
|
|
WORKDIR /src
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN CGO_ENABLED=0 \
|
|
GOOS="${TARGETOS:-linux}" \
|
|
GOARCH="${TARGETARCH:-amd64}" \
|
|
go build \
|
|
-trimpath \
|
|
-ldflags="-s -w -X main.version=${VERSION}" \
|
|
-o /out/opencode2api ./
|
|
|
|
FROM alpine:3.22
|
|
|
|
RUN apk add --no-cache ca-certificates su-exec tzdata \
|
|
&& addgroup -S opencode2api \
|
|
&& adduser -S -G opencode2api -h /var/lib/opencode2api opencode2api \
|
|
&& mkdir -p /app /var/lib/opencode2api \
|
|
&& chown -R opencode2api:opencode2api /app /var/lib/opencode2api
|
|
|
|
COPY --from=builder /out/opencode2api /usr/local/bin/opencode2api
|
|
COPY --chmod=0755 docker-entrypoint.sh /usr/local/bin/docker-entrypoint
|
|
COPY --chown=opencode2api:opencode2api config.example.json /app/config.example.json
|
|
|
|
# LISTEN_ADDRESS / WEBUI_LISTEN_ADDRESS are intentionally unset: config.json is
|
|
# authoritative. Export them to override the configured listen addresses.
|
|
ENV CONFIG_PATH=/var/lib/opencode2api/config.json \
|
|
CONFIG_SEED_PATH= \
|
|
LISTEN_ADDRESS= \
|
|
WEBUI_LISTEN_ADDRESS= \
|
|
STATE_DIR=/var/lib/opencode2api
|
|
|
|
WORKDIR /app
|
|
|
|
EXPOSE 8080 8081
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD wget -q -O /dev/null http://127.0.0.1:8080/healthz || exit 1
|
|
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
|