修复WebUI api 请求地址,更新docker 部署

This commit is contained in:
TOM88812
2025-02-15 22:36:01 +08:00
parent e7645198ba
commit 5b6899052a
13 changed files with 93 additions and 33 deletions
+36 -10
View File
@@ -1,12 +1,31 @@
# 第一阶段:构建依赖
# 第一阶段:前端构建
FROM node:18 as frontend-builder
WORKDIR /app/ZhiKongTaiWeb
COPY ZhiKongTaiWeb/package*.json ./
RUN npm install
COPY ZhiKongTaiWeb .
RUN npm run build
# 第二阶段:构建Python依赖
FROM python:3.10-slim as builder
WORKDIR /app
COPY requirements.txt .
# 安装构建依赖
RUN apt-get update && \
# 使用清华源加速apt安装
RUN rm -rf /etc/apt/sources.list.d/* && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
apt-get clean && \
apt-get update && \
apt-get install -y --no-install-recommends \
gcc \
libopus-dev \
@@ -16,24 +35,31 @@ RUN apt-get update && \
# 安装Python依赖到虚拟环境
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 第阶段:生产镜像
# 第阶段:生产镜像
FROM python:3.10-slim
WORKDIR /opt/xiaozhi-esp32-server
# 从构建阶段复制虚拟环境
COPY --from=builder /opt/venv /opt/venv
# 安装运行时依赖
RUN apt-get update && \
# 使用清华源加速apt安装
RUN rm -rf /etc/apt/sources.list.d/* && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
apt-get clean && \
apt-get update && \
apt-get install -y --no-install-recommends \
libopus0 \
ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# 从构建阶段复制虚拟环境和前端构建产物
COPY --from=builder /opt/venv /opt/venv
COPY --from=frontend-builder /app/ZhiKongTaiWeb/dist /opt/xiaozhi-esp32-server/manager/static
# 设置虚拟环境路径
ENV PATH="/opt/venv/bin:$PATH"