Skip to content

Commit

Permalink
use apt to install azure cli rather than pip
Browse files Browse the repository at this point in the history
  • Loading branch information
devigned committed Sep 11, 2021
1 parent 56b6527 commit 3db33d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions images/capi/Dockerfile
Expand Up @@ -18,6 +18,9 @@ ARG BASE_IMAGE=docker.io/library/ubuntu:focal
FROM $BASE_IMAGE

RUN apt-get update && apt-get install -y apt-transport-https ca-certificates python3-pip curl wget git rsync vim unzip build-essential \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ focal main" | tee /etc/apt/sources.list.d/azure-cli.list \
&& DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get install -y azure-cli \
&& useradd -ms /bin/bash imagebuilder \
&& apt-get purge --auto-remove -y \
&& rm -rf /var/lib/apt/lists/*
Expand Down
11 changes: 6 additions & 5 deletions images/capi/hack/ensure-azure-cli.sh
Expand Up @@ -22,14 +22,15 @@ set -o pipefail

source hack/utils.sh

_version="2.9.0"

# Change directories to the parent directory of the one in which this
# script is located.
cd "$(dirname "${BASH_SOURCE[0]}")/.."

if command -v az >/dev/null 2>&1; then exit 0; fi

ensure_py3
pip3 install --user "azure-cli==${_version}"
ensure_py3_bin az azure-cli
echo "installing Azure CLI"
apt-get update && apt-get install -y ca-certificates curl apt-transport-https lsb-release gnupg
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ${AZ_REPO} main" | tee /etc/apt/sources.list.d/azure-cli.list
apt-get update && apt-get install -y azure-cli

0 comments on commit 3db33d6

Please sign in to comment.