Dockerfile 925 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. FROM golang:1.24-alpine AS builder
  2. RUN apk add --no-cache curl
  3. WORKDIR /aiproxy/core
  4. COPY ./ /aiproxy
  5. RUN sh scripts/tiktoken.sh
  6. RUN go install github.com/swaggo/swag/cmd/swag@latest
  7. RUN sh scripts/swag.sh
  8. RUN go build -trimpath -tags "jsoniter" -ldflags "-s -w" -o aiproxy
  9. # Frontend build stage
  10. FROM node:23-alpine AS frontend-builder
  11. WORKDIR /aiproxy/web
  12. COPY ./web/ ./
  13. # Install pnpm globally
  14. RUN npm install -g pnpm
  15. # Install dependencies and build with pnpm
  16. RUN pnpm install && pnpm run build
  17. FROM alpine:latest
  18. RUN mkdir -p /aiproxy
  19. WORKDIR /aiproxy
  20. VOLUME /aiproxy
  21. RUN apk add --no-cache ca-certificates tzdata ffmpeg curl && \
  22. rm -rf /var/cache/apk/*
  23. COPY --from=builder /aiproxy/core/aiproxy /usr/local/bin/aiproxy
  24. # Copy frontend dist files
  25. COPY --from=frontend-builder /aiproxy/web/dist/ ./web/dist/
  26. ENV PUID=0 PGID=0 UMASK=022
  27. ENV FFMPEG_ENABLED=true
  28. EXPOSE 3000
  29. ENTRYPOINT ["aiproxy"]