Skip to content
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

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions alpine.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ LABEL maintainer="Microsoft" \

ARG JP_VERSION="0.2.1"

WORKDIR azure-cli
COPY . /azure-cli
Comment on lines -37 to -38
Copy link
Member

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 /.

Copy link
Contributor Author

@bebound bebound Nov 2, 2023

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 /

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 \
Copy link
Contributor Author

@bebound bebound Oct 25, 2023

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]

&& apk add --no-cache --virtual .build-deps gcc musl-dev linux-headers libffi-dev curl \
&& update-ca-certificates && ./scripts/install_full.sh && python ./scripts/trim_sdk.py \
&& update-ca-certificates && cd /azure-cli && ./scripts/install_full.sh && python ./scripts/trim_sdk.py \
&& cat /azure-cli/az.completion > ~/.bashrc \
&& dos2unix /root/.bashrc /usr/local/bin/az \
&& 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 \
Expand Down