Dockerfile 707 B

12345678910111213141516171819202122232425262728293031323334
  1. FROM oven/bun:latest AS builder
  2. WORKDIR /build
  3. COPY web/package.json .
  4. RUN bun install
  5. COPY ./web .
  6. COPY ./VERSION .
  7. RUN DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(cat VERSION) bun run build
  8. FROM golang:alpine AS builder2
  9. ENV GO111MODULE=on \
  10. CGO_ENABLED=0 \
  11. GOOS=linux
  12. WORKDIR /build
  13. ADD go.mod go.sum ./
  14. RUN go mod download
  15. COPY . .
  16. COPY --from=builder /build/dist ./web/dist
  17. RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)'" -o one-api
  18. FROM alpine
  19. RUN apk upgrade --no-cache \
  20. && apk add --no-cache ca-certificates tzdata ffmpeg \
  21. && update-ca-certificates
  22. COPY --from=builder2 /build/one-api /
  23. EXPOSE 3000
  24. WORKDIR /data
  25. ENTRYPOINT ["/one-api"]