Dockerfile 913 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. FROM oven/bun:latest AS builder
  2. WORKDIR /build
  3. COPY web/package.json .
  4. COPY web/bun.lock .
  5. RUN bun install
  6. COPY ./web .
  7. COPY ./VERSION .
  8. RUN DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(cat VERSION) bun run build
  9. FROM golang:alpine AS builder2
  10. ENV GO111MODULE=on CGO_ENABLED=0
  11. ARG TARGETOS
  12. ARG TARGETARCH
  13. ENV GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64}
  14. ENV GOEXPERIMENT=greenteagc
  15. WORKDIR /build
  16. ADD go.mod go.sum ./
  17. RUN go mod download
  18. COPY . .
  19. COPY --from=builder /build/dist ./web/dist
  20. RUN go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api
  21. FROM debian:bookworm-slim
  22. RUN apt-get update \
  23. && apt-get install -y --no-install-recommends ca-certificates tzdata libasan8 wget \
  24. && rm -rf /var/lib/apt/lists/* \
  25. && update-ca-certificates
  26. COPY --from=builder2 /build/new-api /
  27. EXPOSE 3000
  28. WORKDIR /data
  29. ENTRYPOINT ["/new-api"]