Skip to content

Commit cf8c7f5

Browse files
authored
⬆️ Az cli update (#18)
* ✏️ updated readme: simplified tag doc, added build arg exemple * ⬆️ updated az cli default version, updated az variable name
1 parent fa0809e commit cf8c7f5

File tree

3 files changed

+35
-22
lines changed

3 files changed

+35
-22
lines changed

README.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77
## Availables Docker image tags
88
Repository available on Docker Hub: [zenika/terraform-azure-cli](https://hub.docker.com/r/zenika/terraform-azure-cli)
99

10-
One images uses [Debian](https://hub.docker.com/_/debian) and the other one uses [Alpine](https://hub.docker.com/_/alpine) as a base.
10+
[Debian](https://hub.docker.com/_/debian) based images ([debian.Dockerfile](https://github.com/Zenika/terraform-azure-cli/blob/master/debian.Dockerfile)):
1111

12-
Debian-based images ([debian.Dockerfile](https://github.com/Zenika/terraform-azure-cli/blob/master/debian.Dockerfile)):
12+
* zenika/terraform-azure-cli:latest-latest - build on master branch
13+
* zenika/terraform-azure-cli:X.Y-debian - build on repository tags
1314

14-
* zenika/terraform-azure-cli:latest-latest - latest image build on master branch
15-
* zenika/terraform-azure-cli:X.Y-debian - versionned image build on repository tags
15+
[Alpine](https://hub.docker.com/_/alpine) based images ([alpine.Dockerfile](https://github.com/Zenika/terraform-azure-cli/blob/master/alpine.Dockerfile)):
1616

17-
Alpine-based images ([alpine.Dockerfile](https://github.com/Zenika/terraform-azure-cli/blob/master/alpine.Dockerfile)):
18-
19-
* zenika/terraform-azure-cli:alpine-latest - latest image build on master branch
20-
* zenika/terraform-azure-cli:X.Y-alpine - versionned image build on repository tags
17+
* zenika/terraform-azure-cli:alpine-latest - build on master branch
18+
* zenika/terraform-azure-cli:X.Y-alpine - build on repository tags
2119

2220
> Git repository tag naming convention: `/^([0-9.]+)$/`
2321
@@ -30,8 +28,8 @@ The goal is to create a **functional**, **minimalist** and **lightweight** image
3028
## What's inside ?
3129
Tools included:
3230

33-
* Azure CLI **v2.0.64**
34-
* Terraform CLI **v0.11.13**
31+
* [Azure CLI](https://azure.microsoft.com), see available version on the [pip repository](https://pypi.org/project/azure-cli/)
32+
* [Terraform CLI](https://www.terraform.io/), see available versions on the [project release page](https://github.com/hashicorp/terraform/releases)
3533

3634
<p align="center">
3735
<a href="https://azure.microsoft.com"><img width="200" src="resources/azure-logo.png"></a>
@@ -49,16 +47,29 @@ docker container run -it --rm zenika/terraform-azure-cli:alpine-latest
4947
> The `--rm` flag will completely destroy the container and its data on exit.
5048
5149
### Build the image
52-
You can build the image locally directly from the Dockerfiles:
50+
You can build the image locally directly from the Dockerfiles.
51+
5352
```bash
54-
# build the Debian based image:
53+
# Build the Debian based image:
5554
docker image build -f debian.Dockerfile -t zenika/terraform-azure-cli:debian .
5655

57-
# build the Alpine based image:
56+
# Build the Alpine based image:
5857
docker image build -f alpine.Dockerfile -t zenika/terraform-azure-cli:alpine .
5958
```
6059

61-
> You can use [Docker build arguments](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg) to set custom Terraform & Azure CLI version.
60+
Optionally, it is possible to choose the tools desired versions using [Docker builds arguments](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg) :
61+
62+
```bash
63+
# Set tools desired versions
64+
AZURE_CLI_VERSION=2.0.65
65+
TERRAFORM_VERSION=0.12.0
66+
67+
# Build the Debian based image:
68+
docker image build --build-arg AZURE_CLI_VERSION=$AZURE_CLI_VERSION --build-arg TERRAFORM_VERSION=$TERRAFORM_VERSION -f debian.Dockerfile -t zenika/terraform-azure-cli:debian .
69+
70+
# Build the Alpine based image:
71+
docker image build --build-arg AZURE_CLI_VERSION=$AZURE_CLI_VERSION --build-arg TERRAFORM_VERSION=$TERRAFORM_VERSION -f alpine.Dockerfile -t zenika/terraform-azure-cli:alpine .
72+
```
6273

6374
## Roadmap & Contributions
6475
Please refer to the [github project](https://github.com/Zenika/terraform-azure-cli/projects/1) to track new features.

alpine.Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
ARG TERRAFORM_VERSION=0.11.13
2-
ARG AZ_CLI_VERSION=2.0.64
1+
# Setup build arguments with default versions
2+
ARG AZURE_CLI_VERSION=2.0.65
3+
ARG TERRAFORM_VERSION=0.11.14
34

45
# Download Terraform binary
56
FROM alpine:3.9.4 as terraform
@@ -13,7 +14,7 @@ RUN unzip -j terraform-${TERRAFORM_VERSION}.zip
1314

1415
# Install az CLI using PIP
1516
FROM alpine:3.9.4 as azure-cli
16-
ARG AZ_CLI_VERSION
17+
ARG AZURE_CLI_VERSION
1718
RUN apk update
1819
RUN apk add python3=3.6.8-r2
1920
RUN apk add python3-dev=3.6.8-r2
@@ -23,7 +24,7 @@ RUN apk add musl-dev=1.1.20-r4
2324
RUN apk add libffi-dev=3.2.1-r6
2425
RUN apk add openssl-dev=1.1.1b-r1
2526
RUN apk add make=4.2.1-r2
26-
RUN pip3 install azure-cli==${AZ_CLI_VERSION}
27+
RUN pip3 install azure-cli==${AZURE_CLI_VERSION}
2728

2829
# Build final image
2930
FROM alpine:3.9.4

debian.Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
ARG TERRAFORM_VERSION=0.11.13
2-
ARG AZ_CLI_VERSION=2.0.64
1+
# Setup build arguments with default versions
2+
ARG AZURE_CLI_VERSION=2.0.65
3+
ARG TERRAFORM_VERSION=0.11.14
34

45
# Download Terraform binary
56
FROM debian:stretch-20190506-slim as terraform
@@ -13,11 +14,11 @@ RUN unzip -j terraform-${TERRAFORM_VERSION}.zip
1314

1415
# Install az CLI using PIP
1516
FROM debian:stretch-20190506-slim as azure-cli-pip
16-
ARG AZ_CLI_VERSION
17+
ARG AZURE_CLI_VERSION
1718
RUN apt-get update
1819
RUN apt-get install -y python3=3.5.3-1
1920
RUN apt-get install -y python3-pip=9.0.1-2+deb9u1
20-
RUN pip3 install azure-cli==${AZ_CLI_VERSION}
21+
RUN pip3 install azure-cli==${AZURE_CLI_VERSION}
2122
# Fix an pyOpenSSL package issue... (see https://github.com/erjosito/ansible-azure-lab/issues/5)
2223
RUN pip3 uninstall -y pyOpenSSL cryptography
2324
RUN pip3 install pyOpenSSL==19.0.0

0 commit comments

Comments
 (0)