mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
Merge branch 'main' into manager-web
This commit is contained in:
commit
e260ade540
6 changed files with 43 additions and 54 deletions
29
Dockerfile
Executable file
29
Dockerfile
Executable file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# 第一阶段:构建Python依赖
|
||||||
|
FROM python:3.10-slim AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY main/xiaozhi-server/requirements.txt .
|
||||||
|
|
||||||
|
# 优化apt安装
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# 第三阶段:生产镜像
|
||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
WORKDIR /opt/xiaozhi-esp32-server
|
||||||
|
|
||||||
|
# 优化apt安装
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends libopus0 ffmpeg && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 从构建阶段复制Python包和前端构建产物
|
||||||
|
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
||||||
|
|
||||||
|
# 复制应用代码
|
||||||
|
COPY main/xiaozhi-server/ .
|
||||||
|
|
||||||
|
# 启动应用
|
||||||
|
CMD ["python", "app.py"]
|
||||||
|
|
@ -35,4 +35,9 @@ public interface ErrorCode {
|
||||||
int REDIS_ERROR = 10027;
|
int REDIS_ERROR = 10027;
|
||||||
int JOB_ERROR = 10028;
|
int JOB_ERROR = 10028;
|
||||||
int INVALID_SYMBOL = 10029;
|
int INVALID_SYMBOL = 10029;
|
||||||
|
|
||||||
|
|
||||||
|
int PASSWORD_LENGTH_ERROR = 10030;
|
||||||
|
int PASSWORD_WEAK_ERROR = 10031;
|
||||||
|
int DEL_MYSELF_ERROR = 10032;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,8 @@ public interface SysDictTypeService extends BaseService<SysDictTypeEntity> {
|
||||||
void update(SysDictTypeDTO dto);
|
void update(SysDictTypeDTO dto);
|
||||||
|
|
||||||
void delete(Long[] ids);
|
void delete(Long[] ids);
|
||||||
|
|
||||||
|
List<DictType> getAllList();
|
||||||
|
|
||||||
|
List<DictType> getDictTypeList();
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# 第一阶段:构建 Python 依赖
|
# 第一阶段:构建 Python 依赖
|
||||||
FROM kalicyh/poetry:v3.10_xiaozhi AS builder
|
FROM kalicyh/poetry:v3.10_xiaozhi AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /opt/xiaozhi-esp32-server
|
||||||
|
|
||||||
# 同时拷贝本地环境.venv
|
# 同时拷贝本地环境.venv
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
# 第一阶段:前端构建
|
|
||||||
FROM node:18 AS frontend-builder
|
|
||||||
|
|
||||||
WORKDIR /app/web
|
|
||||||
|
|
||||||
# 配置npm使用淘宝源
|
|
||||||
RUN npm config set registry https://registry.npmmirror.com
|
|
||||||
|
|
||||||
COPY web/package*.json ./
|
|
||||||
|
|
||||||
# 安装axios依赖
|
|
||||||
RUN npm install axios
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
COPY web .
|
|
||||||
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# 第二阶段:构建Python依赖
|
|
||||||
FROM python:3.10-slim AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY requirements.txt .
|
|
||||||
|
|
||||||
# 优化apt安装
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt \
|
|
||||||
-i https://mirrors.aliyun.com/pypi/simple/
|
|
||||||
|
|
||||||
# 第三阶段:生产镜像
|
|
||||||
FROM python:3.10-slim
|
|
||||||
|
|
||||||
WORKDIR /opt/xiaozhi-esp32-server
|
|
||||||
|
|
||||||
# 优化apt安装
|
|
||||||
RUN echo "deb https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list && \
|
|
||||||
echo "deb https://mirrors.aliyun.com/debian/ bookworm-updates 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 && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# 从构建阶段复制Python包和前端构建产物
|
|
||||||
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
|
||||||
COPY --from=frontend-builder /app/web/dist /opt/xiaozhi-esp32-server/manager/static/webui
|
|
||||||
|
|
||||||
# 复制应用代码
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# 启动应用
|
|
||||||
CMD ["python", "app.py"]
|
|
||||||
|
|
@ -6,6 +6,8 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
security_opt:
|
security_opt:
|
||||||
- seccomp:unconfined
|
- seccomp:unconfined
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
ports:
|
ports:
|
||||||
# ws服务端
|
# ws服务端
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|
@ -13,6 +15,6 @@ services:
|
||||||
- "8002:8002"
|
- "8002:8002"
|
||||||
volumes:
|
volumes:
|
||||||
# 配置文件目录
|
# 配置文件目录
|
||||||
- ./data:/app/data
|
- ./data:/opt/xiaozhi-esp32-server/data
|
||||||
# 模型文件挂接,很重要
|
# 模型文件挂接,很重要
|
||||||
- ./models/SenseVoiceSmall/model.pt:/app/models/SenseVoiceSmall/model.pt
|
- ./models/SenseVoiceSmall/model.pt:/opt/xiaozhi-esp32-server/models/SenseVoiceSmall/model.pt
|
||||||
Loading…
Reference in a new issue