Azure / azure-cli

Azure Command-Line Interface
MIT License
3.96k stars 2.94k forks source link

install latest version of mgmt package only. #25251

Open ozbillwang opened 1 year ago

ozbillwang commented 1 year ago

I found the current installation for Azure-CLI could be huge space used in https://github.com/Azure/azure-cli/issues/19591

When more versions to be added later, the package size could be bigger.

Related command

$ cd <Azure_CLI_package>/azure-cli/2.44.1/libexec/lib/python3.10/site-packages/azure
$ du -sk * |sort -n|tail -2
44368   cli
498384  mgmt

So mgmt takes most space for the package azure-cli

$ cd mgmt/network

$ ls -l 
...
drwxr-xr-x  11 bill  admin     352 11 Jan 02:31 v2020_06_01
drwxr-xr-x  11 bill  admin     352 11 Jan 02:31 v2020_07_01
drwxr-xr-x  11 bill  admin     352 11 Jan 02:31 v2020_08_01
drwxr-xr-x  11 bill  admin     352 11 Jan 02:31 v2020_11_01
drwxr-xr-x  11 bill  admin     352 11 Jan 02:31 v2021_02_01
drwxr-xr-x  12 bill  admin     384 18 Jan 11:20 v2021_02_01_preview
drwxr-xr-x  12 bill  admin     384 18 Jan 11:20 v2022_01_01

$ ls -ld v* |wc -l
      33

So the packages are installed 33 times for all versions for mgmt.

It is only for normal installation, but it makes the size of docker image mcr.microsoft.com/azure-cli to huge (1.35GB)

mcr.microsoft.com/azure-cli        latest                 ba903d03e1cd   6 weeks ago      1.35GB

Are there any options or parameters I can use to only install the latest version in mgmt for production installation?

wangzelin007 commented 1 year ago

@jiasli for awareness