I am trying to install the azure-cli in the dind:latest
image based on alpine.
For context, I want to use it to connect to AKS and deploy an app to Kubernetes via Gitlab.
In my gitlab-ci.yml
file I start with this
image: docker:latest
services:
- docker:dind
and then I try to install the azure-cli
deploy-to-k8s--dev: # k8s namespace "dev"
stage: deploy-to-k8s
# image: microsoft/azure-cli
script:
# I need the azure cli in the dind:latest container
# so install bash,curl and finally the cli
- apk update
- apk upgrade
- apk add bash
- apk add --no-cache curl
- curl -L https://aka.ms/InstallAzureCli | bash
- az
and I get the following error
$ curl -L https://aka.ms/InstallAzureCli | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 167 100 167 0 0 167 0 0:00:01 --:--:-- 0:00:01 644
100 1367 100 1367 0 0 1367 0 0:00:01 --:--:-- 0:00:01 1367
mktemp: Invalid argument
ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1
It is the first time that I try to work with Alpine Linux and I have no idea how it is built and what tools it uses...
Has anyone any suggestion?
EDIT
based on the accepted answer this is the final code that works
deploy-to-k8s--dev: # k8s namespace "dev"
stage: deploy-to-k8s
script:
# I need the azure cli in the dind:latest container
# so install bash,curl and finally the cli
- apk update
- apk upgrade
- apk add bash make py-pip
- apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python2-dev
- pip install azure-cli
- apk del --purge build
- az -h
This helped me in one of my alpine based image
apk update
apk add bash py-pip
apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python- dev
pip install azure-cli
apk del --purge build