Skip to content

Commit

Permalink
Updated dockerfile. (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
thpang authored Feb 19, 2021
1 parent b9fe2e2 commit 74e1d05
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
ARG TERRAFORM_VERSION=0.13.4
ARG AZURECLI_VERSION=2.14.2
ARG TERRAFORM_VERSION=0.13.6
ARG AZURECLI_VERSION=2.19.1

FROM hashicorp/terraform:$TERRAFORM_VERSION as terraform
FROM mcr.microsoft.com/azure-cli:$AZURECLI_VERSION
ARG KUBECTL_VERSION=1.18.8

RUN curl -sLO https://storage.googleapis.com/kubernetes-release/release/v{$KUBECTL_VERSION}/bin/linux/amd64/kubectl \
&& chmod 755 ./kubectl \
&& mv ./kubectl /usr/local/bin/kubectl
COPY --from=terraform /bin/terraform /bin/terraform

WORKDIR /viya4-iac-azure

COPY --from=terraform /bin/terraform /bin/terraform
COPY . .

RUN apk --update --no-cache add git openssh \
&& curl -sLO https://storage.googleapis.com/kubernetes-release/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl \
&& chmod 755 ./kubectl /viya4-iac-azure/docker-entrypoint.sh \
&& mv ./kubectl /usr/local/bin/kubectl \
&& chmod g=u -R /etc/passwd /etc/group /viya4-iac-azure \
&& terraform init /viya4-iac-azure

ENV TF_VAR_iac_tooling=docker
ENTRYPOINT ["/bin/terraform"]
ENTRYPOINT ["/viya4-iac-azure/docker-entrypoint.sh"]
VOLUME ["/workspace"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ Operational knowledge of:
- Access to an **Azure Subscription** and [**Identity**](./docs/user/TerraformAzureAuthentication.md) with '*Contributor*' role
- Terraform or Docker
- #### Terraform
- [Terraform](https://www.terraform.io/downloads.html) - v0.13.4
- [Terraform](https://www.terraform.io/downloads.html) - v0.13.6
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl) - v1.18.8
- [jq](https://stedolan.github.io/jq/) - v1.6
- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure) - v2.19.1 (optional -useful as an alternative to the AWS Web Console)
- #### Docker
- [Docker](https://docs.docker.com/get-docker/)

Expand Down
6 changes: 3 additions & 3 deletions container-structure-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ commandTests:
- name: "terraform version"
command: "terraform"
args: ["--version"]
expectedOutput: ["Terraform v0.13.4"]
expectedOutput: ["Terraform v0.13.6"]
- name: "python version"
command: "python3"
args: ["--version"]
Expand All @@ -26,8 +26,8 @@ commandTests:
- -c
- |
az version -o tsv
expectedOutput: ["2.14.2\t2.14.2\t1.0.6"]
expectedOutput: ["2.19.1\t2.19.1\t1.0.6"]

metadataTest:
workdir: "/viya4-iac-azure"
entrypoint: ["/bin/terraform"]
entrypoint: ["/viya4-iac-azure/docker-entrypoint.sh"]
8 changes: 8 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e

# setup container user
echo "viya4-iac-azure:*:$(id -u):$(id -g):,,,:/viya4-iac-azure:/bin/bash" >> /etc/passwd
echo "viya4-iac-azure:*:$(id -G | cut -d' ' -f 2)" >> /etc/group

exec /bin/terraform $@

0 comments on commit 74e1d05

Please sign in to comment.