Dockerfile 805 B

12345678910111213141516171819202122232425262728293031323334353637
  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. WORKDIR /build
  15. ADD go.mod go.sum ./
  16. RUN go mod download
  17. COPY . .
  18. COPY --from=builder /build/dist ./web/dist
  19. RUN go build -ldflags "-s -w -X 'github.com/QuantumNous/new-api/common.Version=$(cat VERSION)'" -o new-api
  20. FROM alpine
  21. RUN apk upgrade --no-cache \
  22. && apk add --no-cache ca-certificates tzdata \
  23. && update-ca-certificates
  24. COPY --from=builder2 /build/new-api /
  25. EXPOSE 3000
  26. WORKDIR /data
  27. ENTRYPOINT ["/new-api"]