{Packaging} Trim Alpine docker image#27683
Merged
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Collaborator
|
Packaging |
bebound
commented
Oct 25, 2023
| WORKDIR azure-cli | ||
| COPY . /azure-cli | ||
| RUN apk add --no-cache ca-certificates bash bash-completion libintl icu-libs libc6-compat jq openssh-keygen \ | ||
| RUN --mount=type=bind,target=/azure-cli,source=./,rw apk add --no-cache ca-certificates bash bash-completion libintl icu-libs libc6-compat jq openssh-keygen \ |
Contributor
Author
There was a problem hiding this comment.
rw allows writing to mount directory. Otherwise, wheel build fails:
#6 9.533 Building wheels for collected packages: azure-cli-core, azure-cli, azure-cli-telemetry
#6 9.535 Building wheel for azure-cli-core (setup.py): started
#6 9.865 Building wheel for azure-cli-core (setup.py): finished with status 'error'
#6 9.870 error: subprocess-exited-with-error
#6 9.870
#6 9.870 × python setup.py bdist_wheel did not run successfully.
#6 9.870 │ exit code: 1
#6 9.870 ╰─> [5 lines of output]
#6 9.870 running bdist_wheel
#6 9.870 running build
#6 9.870 running build_py
#6 9.870 creating build
#6 9.870 error: could not create 'build': Read-only file system
#6 9.870 [end of output]
3 tasks
jiasli
reviewed
Nov 2, 2023
Comment on lines
-37
to
-38
| WORKDIR azure-cli | ||
| COPY . /azure-cli |
Member
There was a problem hiding this comment.
It is weird to use relative path azure-cli in WORKDIR and absolute path /azure-cli in COPY. This relies on the container's pwd being /.
Contributor
Author
There was a problem hiding this comment.
The alpine and python-alpine image do not set workdir, so its value is / by default.
This line can also be removed later: WORKDIR /
jiasli
approved these changes
Nov 2, 2023
Closed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Trim Alpine docker image by using
RUN --mount.The image size drops from 923MB to 717MB
Ref: https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#run---mount
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.