Skip to content

Commit 45c24e9

Browse files
authored
Updating Dockerfile and readme before v1.0
* 🐳 switching from apt-get to apt, removed unecessary dependancies * 🐳 extracted args from stages and removed useless symbolic link * 🍱 added Azure and Terraform logo in resources * 📝 improved readme: added usage commands, image content, available tags, image size badge * ✨ added docker run script * ✏️ corrected typo and sentence in readme * 👌 review by @pyaillet\nReverted to apt-get as there is no need to use apt-get and it the CLI API is not stable yet; cleaned apt cache after install and do not install recommended packages
1 parent 0c48c6c commit 45c24e9

File tree

6 files changed

+55
-12
lines changed

6 files changed

+55
-12
lines changed

Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
ARG TERRAFORM_VERSION=0.11.13
2+
ARG AZ_CLI_VERSION=2.0.64
3+
14
# Download Terraform binary
25
FROM debian:stretch-20190506-slim as terraform
3-
ARG TERRAFORM_VERSION=0.11.13
6+
ARG TERRAFORM_VERSION
47
RUN apt-get update
58
RUN apt-get install -y curl=7.52.1-5+deb9u9
69
RUN apt-get install -y unzip=6.0-21+deb9u1
@@ -10,22 +13,23 @@ RUN unzip -j terraform-${TERRAFORM_VERSION}.zip
1013

1114
# Install az CLI using PIP
1215
FROM debian:stretch-20190506-slim as azure-cli-pip
13-
ARG AZ_CLI_VERSION=2.0.64
16+
ARG AZ_CLI_VERSION
1417
RUN apt-get update
15-
RUN apt-get install -y curl=7.52.1-5+deb9u9
1618
RUN apt-get install -y python3=3.5.3-1
1719
RUN apt-get install -y python3-pip=9.0.1-2+deb9u1
18-
RUN ln -s /usr/bin/python3 /usr/bin/python
1920
RUN pip3 install azure-cli==${AZ_CLI_VERSION}
20-
# Fix a pyOpenSSL package issue... (see https://github.com/erjosito/ansible-azure-lab/issues/5)
21+
# Fix an pyOpenSSL package issue... (see https://github.com/erjosito/ansible-azure-lab/issues/5)
2122
RUN pip3 uninstall -y pyOpenSSL cryptography
2223
RUN pip3 install pyOpenSSL==19.0.0
2324
RUN pip3 install cryptography==2.6.1
2425

2526
# Build final image
2627
FROM debian:stretch-20190506-slim
27-
RUN apt-get update \
28-
&& apt-get install -y python3=3.5.3-1 ssl-cert=1.0.39 \
28+
RUN apt-get update --no-install-recommends \
29+
# TODO: Handle potential download issue when adding multiples packages with APT
30+
&& apt-get install -y python3=3.5.3-1 \
31+
&& apt-get clean \
32+
&& rm -rf /var/lib/apt/lists/* \
2933
&& ln -s /usr/bin/python3 /usr/bin/python
3034
COPY --from=terraform /terraform /usr/local/bin/terraform
3135
COPY --from=azure-cli-pip /usr/local/bin/az* /usr/local/bin/

README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,49 @@
1+
[![](https://images.microbadger.com/badges/image/zenika/terraform-azure-cli.svg)](https://microbadger.com/images/zenika/terraform-azure-cli)
2+
13
# Terraform and Azure CLI Docker image
2-
Container image including Azure and Terraform CLI tools, build with Docker.
4+
Docker Image including Azure and Terraform CLI tools.
5+
6+
## Availables Docker image tags
7+
Repository available on the Docker Hub: [zenika/terraform-azure-cli](https://hub.docker.com/r/zenika/terraform-azure-cli)
8+
* zenika/terraform-azure-cli:latest - latest image build on master branch
9+
* zenika/terraform-azure-cli:vX.Y - versionned image build on specific repository tag
310

411
## Motivation
5-
Many Docker image including the Terraform and Azure CLI exist out there both on the Docker Hub and Github, but they all are quite oversized (600+ Mo).
12+
Many Docker images including the Terraform and Azure CLI already exist out there, both on the Docker Hub and Github.
13+
But they all are quite oversized.
14+
15+
The goal is to create a functional, minimalist and lightweight image with these tools in order to reduce network and storage impact.
16+
17+
## What's inside ?
18+
This image uses [Debian Stretch](https://hub.docker.com/_/debian) as a base.
19+
20+
Tools included:
21+
22+
* Azure CLI **v2.0.64**
23+
* Terraform CLI **v0.11.13**
624

7-
The goal is to create a functionnal, minimalist and lightweight image with these tools in order to reduce network impact.
25+
<p align="center">
26+
<a href="https://azure.microsoft.com"><img width="200" src="resources/azure-logo.png"></a>
27+
<a href="https://www.terraform.io/"><img width="200" src="resources/terraform-logo.png"></a>
28+
</p>
829

930
## Usage
1031

11-
### Build
32+
### Launch the CLI
33+
Simply launch the container and use the CLI as you would on any other platform:
1234
```bash
13-
./scripts/build.sh
35+
docker container run -it --rm zenika/terraform-azure-cli
1436
```
37+
38+
> The `--rm` flag will completely destroy the container and its data on exit.
39+
40+
### Build the image
41+
Build the image locally directly from the Dockerfile:
42+
```bash
43+
docker image build -t zenika/terraform-azure-cli .
44+
```
45+
46+
## Roadmap & Contributions
47+
Please refer to the [github project](https://github.com/Zenika/terraform-azure-cli/projects/1) to track new features.
48+
49+
Do not hesitate to contribute by [filling an issue](https://github.com/Zenika/terraform-azure-cli/issues) or [a PR](https://github.com/Zenika/terraform-azure-cli/pulls) !

resources/azure-logo.png

22.2 KB
Loading

resources/terraform-logo.png

14 KB
Loading

scripts/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/usr/bin/env bash
2+
23
docker image build -t zenika/terraform-azure-cli .

scripts/run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
docker container run -it --rm zenika/terraform-azure-cli

0 commit comments

Comments
 (0)