mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
使用华为镜像加速构建包下载过程
This commit is contained in:
parent
97b777f1b2
commit
a1fd7aed59
2 changed files with 10 additions and 6 deletions
|
|
@ -5,16 +5,17 @@ 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 -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt
|
||||||
|
|
||||||
# 第二阶段:生产镜像
|
# 第二阶段:生产镜像
|
||||||
FROM python:3.10-slim
|
FROM python:3.10-slim
|
||||||
|
|
||||||
WORKDIR /opt/xiaozhi-esp32-server
|
WORKDIR /opt/xiaozhi-esp32-server
|
||||||
|
|
||||||
# 安装系统依赖
|
# 安装系统依赖,使用华为云镜像源加速
|
||||||
RUN apt-get update && \
|
RUN sed -i 's|http://deb.debian.org/debian|http://mirrors.huaweicloud.com/debian|g' /etc/apt/sources.list.d/debian.sources && \
|
||||||
|
apt-get update && \
|
||||||
apt-get install -y --no-install-recommends libopus0 ffmpeg && \
|
apt-get install -y --no-install-recommends libopus0 ffmpeg && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,11 @@ RUN mvn clean package -Dmaven.test.skip=true
|
||||||
# 第三阶段:构建最终镜像
|
# 第三阶段:构建最终镜像
|
||||||
FROM eclipse-temurin:21-jdk-jammy
|
FROM eclipse-temurin:21-jdk-jammy
|
||||||
|
|
||||||
# 安装Nginx并清理缓存
|
# 安装Nginx并清理缓存,使用华为云镜像源
|
||||||
RUN apt-get update && \
|
RUN sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list && \
|
||||||
|
sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list && \
|
||||||
|
echo "当前的 APT 源配置:" && cat /etc/apt/sources.list && \
|
||||||
|
apt-get update && \
|
||||||
apt-get install -y nginx && \
|
apt-get install -y nginx && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue