xiaozhi-esp32-server/Dockerfile-server
whosmyqueen 01fdd34e48 build(server): 更新服务器镜像并优化 Dockerfile
- 更新 docker-compose_all.yml 中的服务器镜像地址
- 在 Dockerfile-server 中添加阿里云镜像源以加速国内构建
2025-04-28 18:07:11 +08:00

30 lines
No EOL
856 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 第一阶段:构建Python依赖
FROM python:3.10-slim AS builder
WORKDIR /app
COPY main/xiaozhi-server/requirements.txt .
# 安装Python依赖
RUN pip install --no-cache-dir -r requirements.txt
# 第二阶段:生产镜像
FROM python:3.10-slim
WORKDIR /opt/xiaozhi-esp32-server
# if you located in China, you can use aliyun mirror to speed up
RUN sed -i 's@deb.debian.org@mirrors.aliyun.com@g' /etc/apt/sources.list.d/debian.sources
# 安装系统依赖
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"]