-
Notifications
You must be signed in to change notification settings - Fork 3k
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} Trim Alpine docker image #27683
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Packaging |
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 \ |
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.
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]
WORKDIR azure-cli | ||
COPY . /azure-cli |
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 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 /
.
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.
The alpine
and python-alpine
image do not set workdir
, so its value is /
by default.
This line can also be removed later: WORKDIR /
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.