-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Packaging] BREAKING CHANGE: Remove unnecessary packages in docker image #27567
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b886850
Init
bebound 5516ed5
Minor fix
bebound 9c8e701
Merge branch 'dev' into remove-unused
bebound c5c78d1
Add jp jq
bebound acc0cd5
Minor fix
bebound 57469a7
Add openssh-keygen
bebound ed48481
Minor fix
bebound File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,49 +25,24 @@ LABEL maintainer="Microsoft" \ | |
org.label-schema.vcs-url="https://github.com/Azure/azure-cli.git" \ | ||
org.label-schema.docker.cmd="docker run -v \${HOME}/.azure:/root/.azure -it mcr.microsoft.com/azure-cli:$CLI_VERSION" | ||
|
||
# bash gcc make openssl-dev libffi-dev musl-dev - dependencies required for CLI | ||
# openssh - included for ssh-keygen | ||
# ca-certificates | ||
|
||
# curl - required for installing jp | ||
# jq - we include jq as a useful tool | ||
# pip wheel - required for CLI packaging | ||
# jmespath-terminal - we include jpterm as a useful tool | ||
# libintl and icu-libs - required by azure devops artifact (az extension add --name azure-devops) | ||
|
||
# We don't use openssl (3.0) for now. We only install it so that users can use it. | ||
RUN apk add --no-cache bash openssh ca-certificates jq curl openssl perl git zip \ | ||
&& apk add --no-cache --virtual .build-deps gcc make openssl-dev libffi-dev musl-dev linux-headers \ | ||
&& apk add --no-cache libintl icu-libs libc6-compat \ | ||
&& apk add --no-cache bash-completion \ | ||
&& update-ca-certificates | ||
|
||
ARG JP_VERSION="0.2.1" | ||
|
||
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && curl -L https://github.com/jmespath/jp/releases/download/${JP_VERSION}/jp-linux-$arch -o /usr/local/bin/jp \ | ||
&& chmod +x /usr/local/bin/jp | ||
# ca-certificates bash bash-completion - for convenience | ||
# libintl icu-libs - required by azure-devops https://github.com/Azure/azure-cli/pull/9683 | ||
# libc6-compat - required by az storage blob sync https://github.com/Azure/azure-cli/issues/10381 | ||
# gcc python3-dev musl-dev linux-headers libffi-dev - temporarily required by psutil | ||
|
||
WORKDIR azure-cli | ||
COPY . /azure-cli | ||
RUN apk add --no-cache ca-certificates bash bash-completion libintl icu-libs libc6-compat \ | ||
&& apk add --no-cache --virtual .build-deps gcc python3-dev musl-dev linux-headers libffi-dev \ | ||
&& update-ca-certificates && ./scripts/install_full.sh && python ./scripts/trim_sdk.py \ | ||
&& cat /azure-cli/az.completion > ~/.bashrc \ | ||
&& dos2unix /root/.bashrc /usr/local/bin/az \ | ||
&& apk del .build-deps | ||
|
||
# 1. Build packages and store in tmp dir | ||
# 2. Install the cli and the other command modules that weren't included | ||
RUN ./scripts/install_full.sh && python ./scripts/trim_sdk.py \ | ||
&& cat /azure-cli/az.completion > ~/.bashrc \ | ||
&& runDeps="$( \ | ||
scanelf --needed --nobanner --recursive /usr/local \ | ||
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | ||
| sort -u \ | ||
| xargs -r apk info --installed \ | ||
| sort -u \ | ||
)" \ | ||
&& apk add --virtual .rundeps $runDeps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
RUN rm -rf /azure-cli | ||
|
||
WORKDIR / | ||
|
||
# Remove CLI source code from the final image and normalize line endings. | ||
RUN rm -rf ./azure-cli && \ | ||
dos2unix /root/.bashrc /usr/local/bin/az | ||
|
||
ENV AZ_INSTALLER=DOCKER | ||
CMD bash |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This can be replaced by
--mount
to save another 100MB.I'll create a new PR for this.