docker镜像占用空间过大,我查看了项目的dockerfile
里面所使用的基础镜像是
但其实这个版本的node并不是必要的。因为这个镜像里面包含了其他的用不上的用于开发的库。
![image](https://user-images.githubusercontent.com/25550075/189652212-d91005cd-3781-4b45-b89a-7bdb8ef0833d.png)
根据hub可以知道node-slim和node压缩包大小差距非常大。node有352.22 MB,而node-slim只有75.59 MB.
![image](https://user-images.githubusercontent.com/25550075/189652697-734492b1-b6b8-45af-8f4a-573c8ffcd689.png)
解压后node有990.67 MB,而node-slim只有240.47 MB。
我将node替换为node-slim后,镜像仍然运行正常,并且节省了近700MB的空间。
![image](https://user-images.githubusercontent.com/25550075/189653225-699bcf2f-fbc4-47ee-920e-ab67516c86cf.png)
希望作者可以修改dockerfile为