您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

45 行
1.2 KiB

  1. FROM oven/bun:latest AS builder
  2. # 使用淘宝镜像加速
  3. ENV BUN_INSTALL_REGISTRY=https://registry.npmmirror.com
  4. WORKDIR /build
  5. COPY web/package.json .
  6. COPY web/bun.lock .
  7. RUN bun install
  8. COPY ./web .
  9. COPY ./VERSION .
  10. RUN DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(cat VERSION) bun run build
  11. FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/golang:1.26.1-alpine AS builder2
  12. ENV GO111MODULE=on CGO_ENABLED=0
  13. ENV GOPROXY=https://goproxy.cn,direct
  14. ARG TARGETOS
  15. ARG TARGETARCH
  16. ENV GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64}
  17. WORKDIR /build
  18. ADD go.mod go.sum ./
  19. RUN go mod download
  20. COPY . .
  21. COPY --from=builder /build/dist ./web/dist
  22. RUN go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api
  23. FROM debian:bookworm-slim
  24. # 使用阿里云镜像源
  25. RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources
  26. RUN apt-get update \
  27. && apt-get install -y --no-install-recommends ca-certificates tzdata libasan8 wget \
  28. && rm -rf /var/lib/apt/lists/* \
  29. && update-ca-certificates
  30. COPY --from=builder2 /build/new-api /
  31. EXPOSE 3000
  32. WORKDIR /data
  33. ENTRYPOINT ["/new-api"]