Files
new-pai-linghe/Dockerfile
吴中洋 b6db60dbfb feat(billing): 按来源域名将 auto 路由到多层价格池(命名嵌套 auto)
- 新增二级 auto(高价池/低价池): 命名的嵌套 auto, 复用现有 auto 跨子分组选渠道/重试/熔断, 对用户隐藏
- 新增域名路由中间件: 仅 auto 生效, 按 X-Forwarded-Host/Host 改写 UsingGroup+TokenGroup(修复重试陷阱)
- 泛化 channel_select / distributor affinity 的 auto 判定(IsAutoTypeGroup + GetAutoSubGroups)
- 新增 option: SecondaryAutoGroups / DomainAutoRouting; 前端分组定价页加可视化配置表
- 价差来自高/低价池各自挂载的渠道定价(子分组 ratio=1.0), 不使用分组系数
- 恢复 docker 本地源码构建配置(Dockerfile workspace 构建 + compose build + postgres 5433)
2026-06-03 03:52:43 +08:00

51 lines
1.9 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM oven/bun:1@sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7 AS builder
WORKDIR /build
# 前端是 Bun workspace(根在 web/,含 catalog 与 bun.lock),必须从 web/ 根安装才能解析 catalog
COPY web ./web
COPY VERSION ./VERSION
WORKDIR /build/web
RUN bun install --frozen-lockfile
# 构建 default 前端 → web/default/dist
WORKDIR /build/web/default
RUN DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(cat /build/VERSION) bun run build
# classic 前端为旧版(Semi Design),运行时默认主题为 default。
# classic 依赖 semi-ui 版本漂移(锁定为 2.99.x, 旧代码引用的 semi.css 已不再导出)导致构建失败,
# 且基本无人使用。这里用 default 的产物顶替 classic 的 dist仅为满足 go:embed 的存在性要求。
RUN rm -rf /build/web/classic/dist && cp -r /build/web/default/dist /build/web/classic/dist
FROM golang:1.26.1-alpine@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039 AS builder2
ENV GO111MODULE=on CGO_ENABLED=0
ARG TARGETOS
ARG TARGETARCH
ARG GOPROXY=https://proxy.golang.org,direct
ENV GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64}
ENV GOPROXY=${GOPROXY}
ENV GOEXPERIMENT=greenteagc
WORKDIR /build
ADD go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=builder /build/web/default/dist ./web/default/dist
COPY --from=builder /build/web/classic/dist ./web/classic/dist
RUN go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api
FROM debian:bookworm-slim@sha256:f06537653ac770703bc45b4b113475bd402f451e85223f0f2837acbf89ab020a
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates tzdata libasan8 wget \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates
COPY --from=builder2 /build/new-api /
COPY LICENSE NOTICE THIRD-PARTY-LICENSES.md /licenses/
EXPOSE 3000
WORKDIR /data
ENTRYPOINT ["/new-api"]