Skip to content

Commit b86bcba

Browse files
bgauduchbgauduch
andauthored
Base image, dependencies and terraform upgrade (#114)
* renamed dev script * update base image, dependencies and terravorm v1 versions * small updated in actions * update readme * remove useless dependecies from dockerfile Co-authored-by: bgauduch <user.personal@users.noreply.github.com>
1 parent 86a905b commit b86bcba

File tree

9 files changed

+55
-58
lines changed

9 files changed

+55
-58
lines changed

.github/workflows/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: build-test
22

33
# trigger on any push
44
# but not on master or tags
5-
# and only for dockerfile-related modifications
5+
# and only for Dockerfile related modifications
66
on:
77
push:
88
tags-ignore:

.github/workflows/dockerhub-description.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: Update Docker Hub Description
2+
3+
# trigger on master
4+
# and only for readme related modifications
25
on:
36
push:
47
branches:

.github/workflows/lint-dockerfile.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: lint-dockerfile
22

33
# trigger on any push
44
# but not on master or tags
5-
# and only for dockerfile modifications
5+
# and only for Dockerfile related modifications
66
on:
77
push:
88
tags-ignore:
@@ -12,6 +12,7 @@ on:
1212
- "!master"
1313
paths:
1414
- "Dockerfile"
15+
- "hadolint.yaml"
1516
- ".github/workflows/lint-dockerfile.yml"
1617

1718
jobs:

.github/workflows/push-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: push-latest
22

33
# trigger on push to master
4-
# only on image-related modifications
4+
# only on Dockerfile related modifications
55
on:
66
push:
77
branches:

Dockerfile

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
# Build arguments
22
ARG AZURE_CLI_VERSION
33
ARG TERRAFORM_VERSION
4-
ARG PYTHON_MAJOR_VERSION=3.7
5-
ARG DEBIAN_VERSION=buster-20210511-slim
4+
ARG PYTHON_MAJOR_VERSION=3.9
5+
ARG DEBIAN_VERSION=bullseye-20210902-slim
66

77
# Download Terraform binary
88
FROM debian:${DEBIAN_VERSION} as terraform-cli
99
ARG TERRAFORM_VERSION
1010
RUN apt-get update
11-
RUN apt-get install -y --no-install-recommends apt=1.8.2.3
12-
RUN apt-get install -y --no-install-recommends curl=7.64.0-4+deb10u2
13-
RUN apt-get install -y --no-install-recommends ca-certificates=20200601~deb10u2
14-
RUN apt-get install -y --no-install-recommends unzip=6.0-23+deb10u2
15-
RUN apt-get install -y --no-install-recommends gnupg=2.2.12-1+deb10u1
11+
RUN apt-get install --no-install-recommends -y curl=7.74.0-1.3+b1
12+
RUN apt-get install --no-install-recommends -y ca-certificates=20210119
13+
RUN apt-get install --no-install-recommends -y unzip=6.0-26
14+
RUN apt-get install --no-install-recommends -y gnupg=2.2.27-2
1615
WORKDIR /workspace
1716
RUN curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS
1817
RUN curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
@@ -29,14 +28,9 @@ FROM debian:${DEBIAN_VERSION} as azure-cli
2928
ARG AZURE_CLI_VERSION
3029
ARG PYTHON_MAJOR_VERSION
3130
RUN apt-get update
32-
RUN apt-get install -y --no-install-recommends apt=1.8.2.3
33-
RUN apt-get install -y --no-install-recommends python3=${PYTHON_MAJOR_VERSION}.3-1
34-
RUN apt-get install -y --no-install-recommends python3-pip=18.1-5
35-
RUN apt-get install -y --no-install-recommends gcc=4:8.3.0-1
36-
RUN apt-get install -y --no-install-recommends python3-dev=${PYTHON_MAJOR_VERSION}.3-1
37-
RUN pip3 install --upgrade --no-cache-dir pip==21.0.1
38-
RUN pip3 install --no-cache-dir setuptools==54.1.1
39-
RUN pip3 install --no-cache-dir wheel==0.36.2
31+
RUN apt-get install -y --no-install-recommends python3=${PYTHON_MAJOR_VERSION}.2-3
32+
RUN apt-get install -y --no-install-recommends python3-pip=20.3.4-4
33+
RUN pip3 install --no-cache-dir setuptools==58.0.4
4034
RUN pip3 install --no-cache-dir azure-cli==${AZURE_CLI_VERSION}
4135

4236
# Build final image
@@ -45,10 +39,10 @@ LABEL maintainer="bgauduch@github"
4539
ARG PYTHON_MAJOR_VERSION
4640
RUN apt-get update \
4741
&& apt-get install -y --no-install-recommends \
48-
ca-certificates=20200601~deb10u2 \
49-
git=1:2.20.1-2+deb10u3 \
50-
python3=${PYTHON_MAJOR_VERSION}.3-1 \
51-
python3-distutils=${PYTHON_MAJOR_VERSION}.3-1 \
42+
ca-certificates=20210119 \
43+
git=1:2.30.2-1 \
44+
python3=${PYTHON_MAJOR_VERSION}.2-3 \
45+
python3-distutils=${PYTHON_MAJOR_VERSION}.2-1 \
5246
&& apt-get clean \
5347
&& rm -rf /var/lib/apt/lists/* \
5448
&& update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_MAJOR_VERSION} 1

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
[![lint-dockerfile](https://github.com/Zenika/terraform-azure-cli/workflows/lint-dockerfile/badge.svg)](https://github.com/Zenika/terraform-azure-cli/actions?query=workflow%3Alint-dockerfile)
2-
[![build-test](https://github.com/Zenika/terraform-azure-cli/workflows/build-test/badge.svg)](https://github.com/Zenika/terraform-azure-cli/actions?query=workflow%3Abuild-test)
3-
[![push-latest](https://github.com/Zenika/terraform-azure-cli/workflows/push-latest/badge.svg)](https://github.com/Zenika/terraform-azure-cli/actions?query=workflow%3Apush-latest)
4-
[![release](https://github.com/Zenika/terraform-azure-cli/workflows/release/badge.svg)](https://github.com/Zenika/terraform-azure-cli/actions?query=workflow%3Arelease)
1+
[![lint-dockerfile](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/lint-dockerfile.yml/badge.svg)](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/lint-dockerfile.yml)
2+
[![build-test](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/build-test.yml/badge.svg)](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/build-test.yml)
3+
[![push-latest](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/push-latest.yml/badge.svg)](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/push-latest.yml)
4+
[![release](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/release.yml/badge.svg)](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/release.yml)
55

6+
[![Update Docker Hub Description](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/dockerhub-description.yml/badge.svg)](https://github.com/zenika-open-source/terraform-azure-cli/actions/workflows/dockerhub-description.yml)
67
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
78
[![Docker Pulls](https://img.shields.io/docker/pulls/zenika/terraform-azure-cli.svg)](https://hub.docker.com/r/zenika/terraform-azure-cli/)
89

@@ -16,17 +17,17 @@
1617
## 📦 Supported tags and respective Dockerfile links
1718
Available image tags can be found on the Docker Hub registry: [zenika/terraform-azure-cli](https://hub.docker.com/r/zenika/terraform-azure-cli/tags)
1819

19-
Supported versions are listed in the [`supported_versions.json` ](https://github.com/Zenika/terraform-azure-cli/blob/master/supported_versions.json) file in project root folder.
20+
Supported versions are listed in the [`supported_versions.json` ](https://github.com/zenika-open-source/terraform-azure-cli/blob/master/supported_versions.json) file in project root folder.
2021

2122
The following image tag strategy is applied:
2223
* `zenika/terraform-azure-cli:latest` - build from master
23-
* Included CLI versions can be found in the [Dockerfile](https://github.com/Zenika/terraform-azure-cli/blob/master/Dockerfile)
24+
* Included CLI versions are the newest in the [`supported_versions.json` ](https://github.com/zenika-open-source/terraform-azure-cli/blob/master/supported_versions.json) file.
2425
* `zenika/terraform-azure-cli:release-S.T_terraform-UU.VV.WW_azcli-XX.YY.ZZ` - build from releases
2526
* `release-S.T` is the release tag
26-
* `terraform-UU.VV.WWW` is the included Terraform CLI version
27-
* `azcli-XX.YY.ZZ` is the included Azure CLI version
27+
* `terraform-UU.VV.WWW` is the included **Terraform CLI** version
28+
* `azcli-XX.YY.ZZ` is the included **Azure CLI** version
2829

29-
Please report to the [releases page](https://github.com/Zenika/terraform-azure-cli/releases) for the changelogs.
30+
Please report to the [releases page](https://github.com/zenika-open-source/terraform-azure-cli/releases) for the changelogs.
3031

3132
> Any other tags are not supported even if available.
3233
@@ -36,17 +37,16 @@ The goal is to create a **minimalist** and **lightweight** image with these tool
3637
This image gives you the flexibility to be used either for development or as a base image as you see fits.
3738

3839
## 🔧 What's inside ?
40+
3941
* [Azure CLI](https://docs.microsoft.com/cli/azure/?view=azure-cli-latest):
40-
* Included version indicated in the image tag: `azcli-XX.YY.ZZ`
4142
* [Terraform CLI](https://www.terraform.io/docs/commands/index.html):
42-
* Included version indicated in the image tag: `terraform-XX.YY.ZZ`
4343
* [Git](https://git-scm.com/)
4444
* [Python 3](https://www.python.org/)
4545
* This image use a non root user with a GID and UID of 1001 to conform with docker security best practices.
4646

4747
## 🚀 Usage
4848

49-
### Launch the CLI
49+
### 🐚 Launch the CLI
5050
Simply launch the container and use the CLI as you would on any other platform, for instance using the latest image:
5151

5252
```bash
@@ -55,7 +55,7 @@ docker container run -it --rm --mount type=bind,source="$(pwd)",target=/workspac
5555

5656
> The `--rm` flag will completely destroy the container and its data on exit.
5757
58-
### Build the image
58+
### ⚙️ Build the image
5959
You can build the image locally directly from the Dockerfile, using the build script.
6060

6161
It will :
@@ -64,8 +64,8 @@ It will :
6464
* Execute [container structure tests](https://github.com/GoogleContainerTools/container-structure-test) on the image.
6565

6666
```bash
67-
# launch build script using latest supported versions for both Azure and Terraform CLI
68-
./build.sh
67+
# launch dev script using latest supported versions for both Azure and Terraform CLI
68+
./dev.sh
6969
```
7070

7171
Optionally, it is possible to choose the tools desired versions:
@@ -75,42 +75,42 @@ Optionally, it is possible to choose the tools desired versions:
7575
AZURE_CLI_VERSION=2.24.2
7676
TERRAFORM_VERSION=0.15.5
7777

78-
# launch build script with parameters
79-
./build.sh $AZURE_CLI_VERSION $TERRAFORM_VERSION
78+
# launch dev script with parameters
79+
./dev.sh $AZURE_CLI_VERSION $TERRAFORM_VERSION
8080
```
8181

8282
## 🙏 Roadmap & Contributions
83-
Please refer to the [github project](https://github.com/Zenika/terraform-azure-cli/projects/1) to track new features.
83+
Please refer to the [github project](https://github.com/zenika-open-source/terraform-azure-cli/projects/1) to track new features.
8484

85-
Do not hesitate to contribute by [filling an issue](https://github.com/Zenika/terraform-azure-cli/issues) or [opening a PR](https://github.com/Zenika/terraform-azure-cli/pulls) !
85+
Do not hesitate to contribute by [filling an issue](https://github.com/zenika-open-source/terraform-azure-cli/issues/new) or [opening a PR](https://github.com/zenika-open-source/terraform-azure-cli/pulls) !
8686

8787
## ⬆️ Dependencies upgrades checklist
8888

8989
* Supported versions:
90-
* check Azure CLI version (only keep 2 latest releases), available on the [project release page](https://github.com/Azure/azure-cli/releases)
91-
* check Terraform CLI version (keep all minor versions from 0.11), available on the [project release page](https://github.com/hashicorp/terraform/releases)
90+
* check **Azure CLI** version on the [project release page](https://github.com/Azure/azure-cli/releases)
91+
* check **Terraform CLI** version (keep all minor versions from 0.11) available on the [project release page](https://github.com/hashicorp/terraform/releases)
9292
* Dockerfile:
93-
* check base image version on DockerHub
94-
* check OS package versions on Debian package repository
95-
* Available Git versions on the [Debian Packages repository](https://packages.debian.org/search?suite=buster&arch=any&searchon=names&keywords=git)
96-
* Available Python versions on the [Debian packages repository](https://packages.debian.org/search?suite=buster&arch=any&searchon=names&keywords=python3)
97-
* same process for all other packages
98-
* check Pip package versions on [pypi](https://pypi.org/)
93+
* check **base image** version on DockerHub
94+
* check **OS package** versions on Debian package repository
95+
* Available **Git** versions on the [Debian Packages repository](https://packages.debian.org/search?arch=any&searchon=names&keywords=git)
96+
* Available **Python** versions on the [Debian packages repository](https://packages.debian.org/search?arch=any&searchon=names&keywords=python3)
97+
* same process for **all other packages**
98+
* check **Pip package** versions on [pypi](https://pypi.org/)
9999
* Github actions:
100100
* check [runner version](https://github.com/actions/virtual-environments#available-environments)
101-
* check each action release versions
101+
* check **each action release** versions
102102
* Build scripts:
103-
* check container tags:
103+
* check **container tags**:
104104
* [Hadolint releases](https://github.com/hadolint/hadolint/releases)
105105
* [Container-structure-test](https://github.com/GoogleContainerTools/container-structure-test/releases)
106106
* Readme:
107107
* update version in code exemples
108108

109-
## Similar repositories
109+
## 🚩 Similar repositories
110110

111111
* For AWS: [zenika-open-source/terraform-aws-cli](https://github.com/zenika-open-source/terraform-aws-cli)
112112

113113
## 📖 License
114-
This project is under the [Apache License 2.0](https://raw.githubusercontent.com/Zenika/terraform-azure-cli/master/LICENSE)
114+
This project is under the [Apache License 2.0](https://github.com/zenika-open-source/terraform-azure-cli/blob/master/LICENSE)
115115

116116
[![with love by zenika](https://img.shields.io/badge/With%20%E2%9D%A4%EF%B8%8F%20by-Zenika-b51432.svg)](https://oss.zenika.com)

build.sh renamed to dev.sh

File renamed without changes.

supported_versions.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
"0.13.7",
66
"0.14.11",
77
"0.15.5",
8-
"1.0.0"
8+
"1.0.6"
99
],
1010
"azcli_version": [
11-
"2.24.2",
12-
"2.25.0"
11+
"2.28.1"
1312
]
1413
}

tests/container-structure-tests.yml.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ commandTests:
1111
- name: "Check Python version"
1212
command: "python"
1313
args: ["--version"]
14-
expectedOutput: ["Python 3.7.3"]
14+
expectedOutput: ["Python 3.9.2"]
1515

1616
- name: "Check Git version"
1717
command: "git"
1818
args: ["--version"]
19-
expectedOutput: ["git version 2.20.1"]
19+
expectedOutput: ["git version 2.30.2"]
2020

2121
- name: "Check Terraform CLI version"
2222
command: "terraform"

0 commit comments

Comments
 (0)