Skip to content

Commit 22feb5a

Browse files
authored
[Packaging] BREAKING CHANGE: Remove unnecessary packages in docker image (#27567)
1 parent e5716c1 commit 22feb5a

File tree

1 file changed

+14
-34
lines changed

1 file changed

+14
-34
lines changed

alpine.dockerfile

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,29 @@ LABEL maintainer="Microsoft" \
2525
org.label-schema.vcs-url="https://github.com/Azure/azure-cli.git" \
2626
org.label-schema.docker.cmd="docker run -v \${HOME}/.azure:/root/.azure -it mcr.microsoft.com/azure-cli:$CLI_VERSION"
2727

28-
# bash gcc make openssl-dev libffi-dev musl-dev - dependencies required for CLI
29-
# openssh - included for ssh-keygen
30-
# ca-certificates
3128

32-
# curl - required for installing jp
33-
# jq - we include jq as a useful tool
34-
# pip wheel - required for CLI packaging
35-
# jmespath-terminal - we include jpterm as a useful tool
36-
# libintl and icu-libs - required by azure devops artifact (az extension add --name azure-devops)
37-
38-
# We don't use openssl (3.0) for now. We only install it so that users can use it.
39-
RUN apk add --no-cache bash openssh ca-certificates jq curl openssl perl git zip \
40-
&& apk add --no-cache --virtual .build-deps gcc make openssl-dev libffi-dev musl-dev linux-headers \
41-
&& apk add --no-cache libintl icu-libs libc6-compat \
42-
&& apk add --no-cache bash-completion \
43-
&& update-ca-certificates
29+
# ca-certificates bash bash-completion jq jp openssh-keygen - for convenience
30+
# libintl icu-libs - required by azure-devops extension https://github.com/Azure/azure-cli/pull/9683
31+
# libc6-compat - required by az storage blob sync https://github.com/Azure/azure-cli/issues/10381
32+
# gcc musl-dev linux-headers libffi-dev - temporarily required by psutil
33+
# curl - temporarily required by jp
4434

4535
ARG JP_VERSION="0.2.1"
4636

47-
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 \
48-
&& chmod +x /usr/local/bin/jp
49-
5037
WORKDIR azure-cli
5138
COPY . /azure-cli
39+
RUN apk add --no-cache ca-certificates bash bash-completion libintl icu-libs libc6-compat jq openssh-keygen \
40+
&& apk add --no-cache --virtual .build-deps gcc musl-dev linux-headers libffi-dev curl \
41+
&& update-ca-certificates && ./scripts/install_full.sh && python ./scripts/trim_sdk.py \
42+
&& cat /azure-cli/az.completion > ~/.bashrc \
43+
&& dos2unix /root/.bashrc /usr/local/bin/az \
44+
&& 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 \
45+
&& chmod +x /usr/local/bin/jp \
46+
&& apk del .build-deps
5247

53-
# 1. Build packages and store in tmp dir
54-
# 2. Install the cli and the other command modules that weren't included
55-
RUN ./scripts/install_full.sh && python ./scripts/trim_sdk.py \
56-
&& cat /azure-cli/az.completion > ~/.bashrc \
57-
&& runDeps="$( \
58-
scanelf --needed --nobanner --recursive /usr/local \
59-
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
60-
| sort -u \
61-
| xargs -r apk info --installed \
62-
| sort -u \
63-
)" \
64-
&& apk add --virtual .rundeps $runDeps
48+
RUN rm -rf /azure-cli
6549

6650
WORKDIR /
6751

68-
# Remove CLI source code from the final image and normalize line endings.
69-
RUN rm -rf ./azure-cli && \
70-
dos2unix /root/.bashrc /usr/local/bin/az
71-
7252
ENV AZ_INSTALLER=DOCKER
7353
CMD bash

0 commit comments

Comments
 (0)