将Dockerfile COPY分成两段,缓存依赖库,重新构建不需要重新安装

This commit is contained in:
MengDanzz 2023-06-06 14:36:30 +08:00 committed by GitHub
parent ddeaf76422
commit c65def90f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,12 +10,14 @@ RUN echo '[global]' > /etc/pip.conf && \
WORKDIR /gpt
# 装载项目文件
COPY . .
# 安装依赖
COPY requirements.txt ./
RUN pip3 install -r requirements.txt
# 装载项目文件
COPY . .
# 可选步骤,用于预热模块
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'