Skip to content

Commit 42c4e2a

Browse files
authored
⬆️ Terraform and Azure CLI Version update, use non-root user (#106)
* ⬆️ bumped az cli to 2.15.1 * ⬆️ prepare next release with tf 0.14 rc1 and az cli 2.15.1 * 🔧 correct env variables setup in actions * ⬆️ update default terraform version to 0.14.0 and add non-root user * ✅ update tests for Terraform version and non-root user * 🔖 prepare next release * ✏️ add packages indentation back
1 parent ec7ab26 commit 42c4e2a

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ jobs:
2828
- "0.11.14"
2929
- "0.12.29"
3030
- "0.13.5"
31-
- "0.14.0-rc1"
31+
- "0.14.0"
32+
3233
azcli_version:
3334
- "2.13.0"
3435
- "2.14.2"

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Setup build arguments with default versions
22
ARG AZURE_CLI_VERSION=2.15.1
3-
ARG TERRAFORM_VERSION=0.13.5
3+
ARG TERRAFORM_VERSION=0.14.0
44
ARG PYTHON_MAJOR_VERSION=3.7
55
ARG DEBIAN_VERSION=buster-20201012-slim
66

@@ -52,5 +52,12 @@ COPY --from=terraform-cli /terraform /usr/local/bin/terraform
5252
COPY --from=azure-cli /usr/local/bin/az* /usr/local/bin/
5353
COPY --from=azure-cli /usr/local/lib/python${PYTHON_MAJOR_VERSION}/dist-packages /usr/local/lib/python${PYTHON_MAJOR_VERSION}/dist-packages
5454
COPY --from=azure-cli /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
55+
5556
WORKDIR /workspace
57+
RUN groupadd --gid 1001 nonroot \
58+
# user needs a home folder to store azure credentials
59+
&& useradd --gid nonroot --create-home --uid 1001 nonroot \
60+
&& chown nonroot:nonroot /workspace
61+
USER nonroot
62+
5663
CMD ["bash"]

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This image gives you the flexibility to be used for development or as a base ima
4141
* Available versions on the [Debian Packages repository](https://packages.debian.org/search?suite=buster&arch=any&searchon=names&keywords=git)
4242
* [Python 3](https://www.python.org/)
4343
* Available versions on the [Debian packages repository](https://packages.debian.org/search?suite=buster&arch=any&searchon=names&keywords=python3)
44+
* This image use a non root user with a GID and UID of 1001
4445

4546
This image uses a non-root user with a UID and GID of 1001 to conform with docker security best practices.
4647

@@ -73,7 +74,7 @@ Optionally, it is possible to choose the tools desired versions using [Docker bu
7374
```bash
7475
# Set tools desired versions
7576
AZURE_CLI_VERSION=2.15.1
76-
TERRAFORM_VERSION=0.13.5
77+
TERRAFORM_VERSION=0.14.0
7778

7879
# launch the build script with parameters
7980
./dev-build.sh $AZURE_CLI_VERSION $TERRAFORM_VERSION

tests/container-structure-tests.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,25 @@ commandTests:
2121
- name: "Check Terraform CLI version"
2222
command: "terraform"
2323
args: ["version"]
24-
expectedOutput: ["Terraform v0.13.5"]
24+
expectedOutput: ["Terraform v0.14.0"]
2525

2626
- name: "Check Azure CLI version"
2727
command: "az"
2828
args: ["version"]
2929
expectedOutput: ['"azure-cli": "2.15.1"']
30+
31+
fileExistenceTests:
32+
- name: 'Check nonroot user home'
33+
path: '/home/nonroot'
34+
shouldExist: true
35+
permissions: 'drwxr-xr-x'
36+
uid: 1001
37+
gid: 1001
38+
isExecutableBy: 'group'
39+
- name: 'Check nonroot user rights on /workspace folder'
40+
path: '/workspace'
41+
shouldExist: true
42+
permissions: 'drwxr-xr-x'
43+
uid: 1001
44+
gid: 1001
45+
isExecutableBy: 'group'

0 commit comments

Comments
 (0)