diff --git a/alpine.dockerfile b/alpine.dockerfile index 003c3a0834f..9773dc70e1b 100644 --- a/alpine.dockerfile +++ b/alpine.dockerfile @@ -25,49 +25,29 @@ 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 +# ca-certificates bash bash-completion jq jp openssh-keygen - for convenience +# libintl icu-libs - required by azure-devops extension 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 musl-dev linux-headers libffi-dev - temporarily required by psutil +# curl - temporarily required by jp 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 - WORKDIR azure-cli COPY . /azure-cli +RUN apk add --no-cache ca-certificates bash bash-completion libintl icu-libs libc6-compat jq openssh-keygen \ + && 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 \ + && 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 \ + && chmod +x /usr/local/bin/jp \ + && 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 +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