优化镜像分层

This commit is contained in:
2024-10-12 11:32:09 +08:00
parent 7b9d9ca589
commit 608a647621

View File

@@ -11,12 +11,14 @@ ENV PYTHONUNBUFFERED=1 \
# 设置pip镜像地址加快安装速度 # 设置pip镜像地址加快安装速度
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
# 安装依赖 # 安装
COPY sources.list /etc/apt/sources.list COPY sources.list /etc/apt/sources.list
COPY requirements.txt /app/requirements.txt
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone \ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone \
&& apt-get update && apt-get install libgl1 \ && apt-get install libgl1
&& pip install --no-cache-dir -r requirements.txt
# 安装依赖
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# 将当前目录内容复制到容器的/app内 # 将当前目录内容复制到容器的/app内
COPY . /app COPY . /app