Dockerfile 716 B

1234567891011121314151617181920212223242526272829303132333435
  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 update \
  20. && apk upgrade \
  21. && apk add --no-cache ca-certificates tzdata ffmpeg \
  22. && update-ca-certificates
  23. COPY --from=builder2 /build/one-api /
  24. EXPOSE 3000
  25. WORKDIR /data
  26. ENTRYPOINT ["/one-api"]