Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

46 righe
1.1 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 golang: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. ENV GOEXPERIMENT=greenteagc
  18. WORKDIR /build
  19. ADD go.mod go.sum ./
  20. RUN go mod download
  21. COPY . .
  22. COPY --from=builder /build/dist ./web/dist
  23. RUN go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api
  24. FROM debian:bookworm-slim
  25. # 使用阿里云镜像源
  26. RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources
  27. RUN apt-get update \
  28. && apt-get install -y --no-install-recommends ca-certificates tzdata libasan8 wget \
  29. && rm -rf /var/lib/apt/lists/* \
  30. && update-ca-certificates
  31. COPY --from=builder2 /build/new-api /
  32. EXPOSE 3000
  33. WORKDIR /data
  34. ENTRYPOINT ["/new-api"]