update Ddockerfile-server-base

This commit is contained in:
Jordan 2026-10-09 10:16:18 -03:00
parent 7dfb16e484
commit 37150d60b5

View file

@ -2,31 +2,25 @@
# 基础镜像,包含系统依赖和Python包 # 基础镜像,包含系统依赖和Python包
FROM python:3.10-slim FROM python:3.10-slim
# 安装系统依赖 # Instalar dependências do sistema e configurar locale PT-BR
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends libopus0 ffmpeg locales && \ apt-get install -y --no-install-recommends libopus0 ffmpeg locales && \
sed -i '/zh_CN.UTF-8/s/^# //g' /etc/locale.gen && \ sed -i '/pt_BR.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen && \ locale-gen && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# 配置pip使用国内镜像源(阿里云)并设置超时和重试 # Configurar variáveis de ambiente
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \ ENV LANG=pt_BR.UTF-8 \
pip config set global.trusted-host mirrors.aliyun.com && \ LC_ALL=pt_BR.UTF-8 \
pip config set global.timeout 120 && \ LANGUAGE=pt_BR:pt \
pip config set install.retries 5
# 设置环境变量以确保正确的字符编码
ENV LANG=zh_CN.UTF-8 \
LC_ALL=zh_CN.UTF-8 \
LANGUAGE=zh_CN:zh \
PYTHONIOENCODING=utf-8 PYTHONIOENCODING=utf-8
WORKDIR /opt/xiaozhi-esp32-server WORKDIR /opt/xiaozhi-esp32-server
# 复制requirements.txt # Copiar o arquivo de requisitos
COPY main/xiaozhi-server/requirements.txt . COPY main/xiaozhi-server/requirements.txt .
# 安装Python依赖 # Instalar dependências do Python usando o PyPI oficial (muito mais rápido no Brasil)
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \ RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt --default-timeout=120 --retries 5 pip install --no-cache-dir -r requirements.txt