如何使用缓存的Docker映像加快云运行部署

ffscu2ro  于 2023-03-17  发布在  Docker
关注(0)|答案(1)|浏览(108)

我正在使用google cloud run来部署我的应用程序。每次我部署应用程序时,构建大约需要22分钟,因为dlib库(必需库之一)非常大。我最终得到了如下的结果:

Building wheels for collected packages: dlib, face-recognition-models
  Building wheel for dlib (setup.py): started
  Building wheel for dlib (setup.py): still running...
  Building wheel for dlib (setup.py): still running...
  Building wheel for dlib (setup.py): still running...
  Building wheel for dlib (setup.py): still running...
  Building wheel for dlib (setup.py): still running...
  Building wheel for dlib (setup.py): still running...
  Building wheel for dlib (setup.py): still running...
  Building wheel for dlib (setup.py): still running...

有没有办法缓存docker图像,这样我就可以加快构建速度?无论何时我在本地运行pip install -r requirements.txt,它都非常快,因为pip在它的缓存中有库。我在Artifact Registry中保存了以前构建的docker图像。

i7uaboj4

i7uaboj41#

您至少有两个选项可以通过存储缓存层来加速构建,这主要取决于您的方法:https://cloud.google.com/build/docs/optimize-builds/speeding-up-builds

相关问题