Skip to content

Commit

Permalink
feat: image link
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Apr 29, 2024
1 parent 66c2d3a commit 3eaf200
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/devops/reduce-python-image-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tag:

## 背景
当你为 LLM 应用构建镜像时,发现整个过程很慢,一看镜像体积:好家伙,1.76 G!
![](https://cdn.nlark.com/yuque/0/2024/png/160590/1704179561250-cca8b370-edb0-4d90-a0d1-4e4db5e25a71.png)
![](https://raw.githubusercontent.com/levy9527/image-holder/main/md-image-kit/1704179561250-cca8b370-edb0-4d90-a0d1-4e4db5e25a71.png)
能不能减少镜像体积,缩短打包时间啊?本文将分享两招实用的技巧,让 Python 应用的镜像体积减少 50%。

<!-- more -->
Expand Down Expand Up @@ -67,10 +67,10 @@ run pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip && \
```
## 优化效果
第一次优化,使用 slim 镜像:
![](https://cdn.nlark.com/yuque/0/2024/png/160590/1704179592750-ab34f91e-7ab7-45e4-856a-314341602a74.png)
![](https://raw.githubusercontent.com/levy9527/image-holder/main/md-image-kit/1704179592750-ab34f91e-7ab7-45e4-856a-314341602a74.png)

第二次优化,减少层数、取消本地缓存:
![](https://cdn.nlark.com/yuque/0/2024/png/160590/1704179609044-68068d48-0b3b-4f5f-be9a-7745a9173f98.png)
![](https://raw.githubusercontent.com/levy9527/image-holder/main/md-image-kit/1704179609044-68068d48-0b3b-4f5f-be9a-7745a9173f98.png)
小小的改动,大大的变化!
## 参考
[https://icloudnative.io/posts/intro-guide-to-dockerfile-best-practices/](https://icloudnative.io/posts/intro-guide-to-dockerfile-best-practices/)
Expand Down

0 comments on commit 3eaf200

Please sign in to comment.