2016-07-21 21:26:41 +03:00
|
|
|
#---------------------------------------------------------------------------------------------
|
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
#---------------------------------------------------------------------------------------------
|
|
|
|
|
2021-04-27 08:53:18 +03:00
|
|
|
ARG PYTHON_VERSION="3.8.9"
|
2018-12-13 00:00:05 +03:00
|
|
|
|
2021-04-27 08:53:18 +03:00
|
|
|
FROM python:${PYTHON_VERSION}-alpine3.13
|
2016-07-06 01:50:33 +03:00
|
|
|
|
2017-10-18 19:39:23 +03:00
|
|
|
ARG CLI_VERSION
|
|
|
|
|
|
|
|
# Metadata as defined at http://label-schema.org
|
|
|
|
ARG BUILD_DATE
|
2018-05-09 00:15:07 +03:00
|
|
|
|
2017-10-27 19:16:14 +03:00
|
|
|
LABEL maintainer="Microsoft" \
|
|
|
|
org.label-schema.schema-version="1.0" \
|
2017-10-18 19:39:23 +03:00
|
|
|
org.label-schema.vendor="Microsoft" \
|
2018-07-11 00:01:20 +03:00
|
|
|
org.label-schema.name="Azure CLI" \
|
2017-10-18 19:39:23 +03:00
|
|
|
org.label-schema.version=$CLI_VERSION \
|
|
|
|
org.label-schema.license="MIT" \
|
2018-07-11 00:01:20 +03:00
|
|
|
org.label-schema.description="The Azure CLI is used for all Resource Manager deployments in Azure." \
|
2019-08-20 08:09:19 +03:00
|
|
|
org.label-schema.url="https://docs.microsoft.com/cli/azure/overview" \
|
|
|
|
org.label-schema.usage="https://docs.microsoft.com/cli/azure/install-az-cli2#docker" \
|
2017-10-18 19:39:23 +03:00
|
|
|
org.label-schema.build-date=$BUILD_DATE \
|
|
|
|
org.label-schema.vcs-url="https://github.com/Azure/azure-cli.git" \
|
2019-12-25 08:23:45 +03:00
|
|
|
org.label-schema.docker.cmd="docker run -v \${HOME}/.azure:/root/.azure -it mcr.microsoft.com/azure-cli:$CLI_VERSION"
|
2017-10-18 19:39:23 +03:00
|
|
|
|
2017-08-01 20:40:03 +03:00
|
|
|
# bash gcc make openssl-dev libffi-dev musl-dev - dependencies required for CLI
|
2016-11-17 00:38:23 +03:00
|
|
|
# openssh - included for ssh-keygen
|
2017-08-01 20:40:03 +03:00
|
|
|
# ca-certificates
|
2016-07-06 21:33:02 +03:00
|
|
|
|
2018-05-09 00:15:07 +03:00
|
|
|
# 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
|
2019-06-14 18:31:51 +03:00
|
|
|
# libintl and icu-libs - required by azure devops artifact (az extension add --name azure-devops)
|
2020-02-06 06:26:24 +03:00
|
|
|
RUN apk add --no-cache bash openssh ca-certificates jq curl openssl perl git zip \
|
2019-04-04 23:24:22 +03:00
|
|
|
&& apk add --no-cache --virtual .build-deps gcc make openssl-dev libffi-dev musl-dev linux-headers \
|
2020-10-23 12:22:00 +03:00
|
|
|
&& apk add --no-cache libintl icu-libs libc6-compat \
|
2020-10-13 09:05:26 +03:00
|
|
|
&& apk add --no-cache bash-completion \
|
2018-12-13 00:00:05 +03:00
|
|
|
&& update-ca-certificates
|
|
|
|
|
|
|
|
ARG JP_VERSION="0.1.3"
|
|
|
|
|
2019-05-20 20:49:28 +03:00
|
|
|
RUN curl -L https://github.com/jmespath/jp/releases/download/${JP_VERSION}/jp-linux-amd64 -o /usr/local/bin/jp \
|
2018-05-09 00:15:07 +03:00
|
|
|
&& chmod +x /usr/local/bin/jp \
|
2018-12-13 00:00:05 +03:00
|
|
|
&& pip install --no-cache-dir --upgrade jmespath-terminal
|
|
|
|
|
|
|
|
WORKDIR azure-cli
|
|
|
|
COPY . /azure-cli
|
|
|
|
|
|
|
|
# 1. Build packages and store in tmp dir
|
|
|
|
# 2. Install the cli and the other command modules that weren't included
|
2019-06-28 02:55:08 +03:00
|
|
|
RUN ./scripts/install_full.sh \
|
2018-12-19 02:46:04 +03:00
|
|
|
&& cat /azure-cli/az.completion > ~/.bashrc \
|
2018-05-09 00:15:07 +03:00
|
|
|
&& runDeps="$( \
|
|
|
|
scanelf --needed --nobanner --recursive /usr/local \
|
|
|
|
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
|
|
|
|
| sort -u \
|
|
|
|
| xargs -r apk info --installed \
|
|
|
|
| sort -u \
|
|
|
|
)" \
|
2019-01-22 23:33:57 +03:00
|
|
|
&& apk add --virtual .rundeps $runDeps
|
2016-07-06 01:50:33 +03:00
|
|
|
|
2016-08-03 21:28:48 +03:00
|
|
|
WORKDIR /
|
|
|
|
|
2018-12-20 03:46:34 +03:00
|
|
|
# Remove CLI source code from the final image and normalize line endings.
|
|
|
|
RUN rm -rf ./azure-cli && \
|
|
|
|
dos2unix /root/.bashrc /usr/local/bin/az
|
2018-12-13 00:00:05 +03:00
|
|
|
|
2020-03-25 08:36:16 +03:00
|
|
|
ENV AZ_INSTALLER=DOCKER
|
2016-11-02 20:15:21 +03:00
|
|
|
CMD bash
|