6ef9e082a6
- 前端: VAD语音检测(@ricky0123/vad-web) + useVoiceInput双模式(流式WS/REST) - Gateway: VoiceStreamManager代理WS流式STT到voice-service - Voice-service: DashScope REST → Realtime WS → Whisper三级引擎 + ffmpeg转码 - 共享模块: pkg/audio(音频转换) + pkg/dashscope(ASR REST客户端) - 清理: 移除旧plugin-manager和pkg/plugins,完成插件→工具合并 - 文档: 完善gateway-api.md和voice-service.md语音API文档 - 工具: scripts/voice/ 语音转换脚本集 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
40 lines
1.0 KiB
Docker
40 lines
1.0 KiB
Docker
# ========== 构建阶段 ==========
|
|
FROM golang:1.26-alpine AS builder
|
|
|
|
RUN apk add --no-cache git ca-certificates
|
|
|
|
WORKDIR /app
|
|
|
|
# 复制服务代码 + 共享 pkg(保持目录结构以匹配 go.mod replace 路径)
|
|
COPY backend/ai-core/ ./backend/ai-core/
|
|
COPY backend/pkg/ ./backend/pkg/
|
|
|
|
WORKDIR /app/backend/ai-core
|
|
ENV GOPROXY=https://goproxy.cn,direct
|
|
RUN go mod download
|
|
|
|
# 编译 (静态链接)
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /ai-core ./cmd/main.go
|
|
|
|
# ========== 运行阶段 ==========
|
|
FROM alpine:3.20
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata ffmpeg && \
|
|
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
|
echo "Asia/Shanghai" > /etc/timezone
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /ai-core .
|
|
COPY --from=builder /app/backend/ai-core/internal/persona/ ./internal/persona/
|
|
|
|
RUN adduser -D -H cyrene
|
|
USER cyrene
|
|
|
|
EXPOSE 8081
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:8081/api/v1/health || exit 1
|
|
|
|
ENTRYPOINT ["./ai-core"]
|