mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 00:23:53 +08:00
+21
-27
@@ -1,46 +1,40 @@
|
|||||||
# 第一阶段:前端构建
|
# 第一阶段:前端构建
|
||||||
FROM node:18 AS frontend-builder
|
FROM ccr.ccs.tencentyun.com/kalicyh/node:18-alpine AS frontend-builder
|
||||||
|
|
||||||
WORKDIR /app/ZhiKongTaiWeb
|
WORKDIR /app/ZhiKongTaiWeb
|
||||||
|
|
||||||
RUN corepack enable && yarn config set registry https://registry.npmmirror.com
|
|
||||||
|
|
||||||
COPY ZhiKongTaiWeb/package.json ZhiKongTaiWeb/yarn.lock ./
|
COPY ZhiKongTaiWeb/package.json ZhiKongTaiWeb/yarn.lock ./
|
||||||
|
|
||||||
RUN mkdir node_modules && yarn install --frozen-lockfile
|
RUN yarn install --frozen-lockfile
|
||||||
|
|
||||||
COPY ZhiKongTaiWeb .
|
COPY ZhiKongTaiWeb .
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
# 第二阶段:构建 Python 依赖
|
# 第二阶段:构建 Python 依赖
|
||||||
FROM ccr.ccs.tencentyun.com/kalicyh/poetry:v3.10_latest AS builder
|
FROM ccr.ccs.tencentyun.com/kalicyh/poetry:v3.10_xiaozhi AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY pyproject.toml poetry.lock /app/
|
|
||||||
|
# 同时拷贝本地环境.venv
|
||||||
|
COPY . .
|
||||||
|
# 检查是否有缺失
|
||||||
RUN poetry install --no-root
|
RUN poetry install --no-root
|
||||||
|
|
||||||
# 第三阶段:生产镜像
|
# 使用清华源加速apt安装,该镜像内置所以注释
|
||||||
FROM python:3.10-slim
|
# 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 && \
|
||||||
WORKDIR /opt/xiaozhi-esp32-server
|
# 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 && \
|
||||||
# 使用清华源加速apt安装
|
# echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
|
||||||
RUN rm -rf /etc/apt/sources.list.d/* && \
|
# apt-get update && \
|
||||||
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list && \
|
# apt-get install -y --no-install-recommends libopus0 ffmpeg && \
|
||||||
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \
|
# apt-get clean
|
||||||
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 update && \
|
|
||||||
apt-get install -y --no-install-recommends libopus0 ffmpeg && \
|
|
||||||
apt-get clean
|
|
||||||
|
|
||||||
# 从构建阶段复制虚拟环境和前端构建产物
|
# 从构建阶段复制虚拟环境和前端构建产物
|
||||||
COPY --from=builder /app/.venv /opt/venv
|
COPY --from=frontend-builder /app/ZhiKongTaiWeb/dist /app/manager/static/webui
|
||||||
COPY --from=frontend-builder /app/ZhiKongTaiWeb/dist /opt/xiaozhi-esp32-server/manager/static/webui
|
|
||||||
# 设置虚拟环境路径
|
# 设置虚拟环境路径
|
||||||
ENV PATH="/opt/venv/bin:$PATH"
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
# 复制应用代码
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# 启动应用
|
# 启动应用
|
||||||
CMD ["python", "app.py"]
|
ENTRYPOINT ["poetry", "run", "python"]
|
||||||
|
CMD ["app.py"]
|
||||||
+1
-1
@@ -9,7 +9,7 @@ def setup_logging(log_dir='tmp', data_dir='data'):
|
|||||||
|
|
||||||
# 设置日志格式,时间、日志级别、标签、消息
|
# 设置日志格式,时间、日志级别、标签、消息
|
||||||
log_format = (
|
log_format = (
|
||||||
"<green>{time:YYYY-MM-DD HH:mm:ss}</green>"
|
# "<green>{time:YYYY-MM-DD HH:mm:ss}</green>"
|
||||||
"[<light-blue>{extra[tag]}</light-blue>]"
|
"[<light-blue>{extra[tag]}</light-blue>]"
|
||||||
" - <level>{level}</level> - "
|
" - <level>{level}</level> - "
|
||||||
"<light-green>{message}</light-green>"
|
"<light-green>{message}</light-green>"
|
||||||
|
|||||||
+3
-2
@@ -1,11 +1,12 @@
|
|||||||
services:
|
services:
|
||||||
xiaozhi-esp32-server:
|
xiaozhi-esp32-server:
|
||||||
image: ccr.ccs.tencentyun.com/xinnan/xiaozhi-esp32-server:latest
|
image: ccr.ccs.tencentyun.com/kalicyh/esp32-ai-server:latest
|
||||||
container_name: xiaozhi-esp32-server
|
container_name: xiaozhi-esp32-server
|
||||||
restart: always
|
restart: always
|
||||||
#security_opt:
|
#security_opt:
|
||||||
# - seccomp:unconfined
|
# - seccomp:unconfined
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
- "8002:8002"
|
||||||
volumes:
|
volumes:
|
||||||
- ./.config.yaml:/opt/xiaozhi-esp32-server/config.yaml
|
- ./data:/app/data
|
||||||
Generated
+5
-665
File diff suppressed because it is too large
Load Diff
@@ -28,11 +28,6 @@ setuptools = "^75.8.0"
|
|||||||
loguru = "^0.7.3"
|
loguru = "^0.7.3"
|
||||||
|
|
||||||
|
|
||||||
[[tool.poetry.source]]
|
|
||||||
name = "mirrors"
|
|
||||||
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
|
|
||||||
priority = "primary"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|||||||
Reference in New Issue
Block a user