-
Notifications
You must be signed in to change notification settings - Fork 7k
[release] Add Azure CLI to base-extra image #58012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: kevin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds Azure CLI to the base-extra image by including necessary packages and configurations in the Dockerfile. The changes involve adding curl, gnupg, and lsb-release to the list of APT packages, setting up the Microsoft package repository, and installing Azure CLI. The added packages and configurations are essential for installing and using Azure CLI within the Docker image.
| curl -sLS https://packages.microsoft.com/keys/microsoft.asc | | ||
| gpg --dearmor | sudo tee /etc/apt/keyrings/microsoft.gpg > /dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's generally better to combine multiple commands into a single RUN instruction using && to reduce the number of layers in the Docker image. This can improve build speed and reduce image size.
Consider combining the curl and gpg commands into a single RUN instruction.
RUN curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/keyrings/microsoft.gpg > /dev/null
| AZ_VER=2.72.0 | ||
| AZ_DIST="$(lsb_release -cs)" | ||
| echo "Types: deb | ||
| URIs: https://packages.microsoft.com/repos/azure-cli/ | ||
| Suites: ${AZ_DIST} | ||
| Components: main | ||
| Architectures: $(dpkg --print-architecture) | ||
| Signed-by: /etc/apt/keyrings/microsoft.gpg" | sudo tee /etc/apt/sources.list.d/azure-cli.sources | ||
|
|
||
| sudo apt-get update -y | ||
| sudo apt-get install -y azure-cli="${AZ_VER}"-1~"${AZ_DIST}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using ARG to define the Azure CLI version (AZ_VER) so that it can be easily overridden during the build process. This makes the Dockerfile more flexible and configurable.
Also, it would be better to combine all the commands related to setting up the Azure CLI repository and installing Azure CLI into a single RUN instruction to reduce the number of layers in the Docker image.
ARG AZ_VER=2.72.0
RUN AZ_DIST="$(lsb_release -cs)" && \
echo "Types: deb\nURIs: https://packages.microsoft.com/repos/azure-cli/\nSuites: ${AZ_DIST}\nComponents: main\nArchitectures: $(dpkg --print-architecture)\nSigned-by: /etc/apt/keyrings/microsoft.gpg" | sudo tee /etc/apt/sources.list.d/azure-cli.sources && \
sudo apt-get update -y && \
sudo apt-get install -y azure-cli="${AZ_VER}"-1~"${AZ_DIST}"
| sudo apt-get autoclean | ||
| sudo rm -rf /etc/apt/sources.list.d/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After installing the Azure CLI, it's a good practice to clean up the APT package lists to reduce the image size. This can be done by adding sudo apt-get clean to the Dockerfile.
Also, consider combining the autoclean and rm commands into a single RUN instruction.
RUN sudo apt-get autoclean && sudo rm -rf /etc/apt/sources.list.d/*
Signed-off-by: kevin <[email protected]>
| curl | ||
| gnupg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gnupg and curl are already inside the image. they do not need to be reinstalled here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed!
|
could you add a PR description? |
Signed-off-by: kevin <[email protected]>
Add Azure CLI and dependencies into `base-extra` images --------- Signed-off-by: kevin <[email protected]> Signed-off-by: xgui <[email protected]>
Add Azure CLI and dependencies into `base-extra` images --------- Signed-off-by: kevin <[email protected]>
Add Azure CLI and dependencies into `base-extra` images --------- Signed-off-by: kevin <[email protected]> Signed-off-by: Aydin Abiar <[email protected]>
Add Azure CLI and dependencies into `base-extra` images --------- Signed-off-by: kevin <[email protected]> Signed-off-by: Future-Outlier <[email protected]>
Add Azure CLI and dependencies into
base-extraimages