build(Dockerfile-server): 使用阿里云镜像源加速国内构建- 在 Python 依赖安装中添加阿里云 PyPI 镜像源

- 更新 APT镜像源为阿里云 Debian镜像源
- 适用于在国内环境下加速镜像构建过程
This commit is contained in:
whosmyqueen 2025-04-28 19:35:53 +08:00
parent bd47b60fec
commit 2fe8d8d490

View file

@ -6,14 +6,16 @@ WORKDIR /app
COPY main/xiaozhi-server/requirements.txt . COPY main/xiaozhi-server/requirements.txt .
# 安装Python依赖 # 安装Python依赖
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
# 第二阶段:生产镜像 # 第二阶段:生产镜像
FROM python:3.10-slim FROM python:3.10-slim
WORKDIR /opt/xiaozhi-esp32-server WORKDIR /opt/xiaozhi-esp32-server
# if you located in China, you can use aliyun mirror to speed up # 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 sed -i 's@deb.debian.org@mirrors.aliyun.com@g' /etc/apt/sources.list.d/debian.sources
# 安装系统依赖 # 安装系统依赖
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends libopus0 ffmpeg && \ apt-get install -y --no-install-recommends libopus0 ffmpeg && \