Skip to content

Commit 0e4dc76

Browse files
author
Sean Sundberg
authored
Replaces base image with one that provides multi-arch (#53)
- Use alpine:3.16.0 as the base - Add logic to install `git` and download the terraform cli for the arch Signed-off-by: Sean Sundberg <seansund@us.ibm.com>
1 parent 874574a commit 0e4dc76

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
FROM docker.io/hashicorp/terraform:1.1.9
1+
FROM alpine:3.16.0
22

33
ARG TARGETPLATFORM
44
ENV OPENSHIFT_CLI_VERSION 4.10
5+
ENV TERRAFORM_VERSION 1.1.9
6+
ENV TERRAGRUNT_VERSION 0.36.10
57

6-
RUN apk add --update-cache \
8+
RUN apk add --no-cache \
79
curl \
810
unzip \
911
sudo \
@@ -14,9 +16,18 @@ RUN apk add --update-cache \
1416
perl \
1517
openvpn \
1618
gcompat \
19+
git \
1720
jq \
1821
&& rm -rf /var/cache/apk/*
1922

23+
RUN curl -Lso /tmp/terraform.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_$(if [[ "$TARGETPLATFORM" == "linux/arm64" ]]; then echo "arm64"; else echo "amd64"; fi).zip && \
24+
mkdir -p /tmp/terraform && \
25+
cd /tmp/terraform && \
26+
unzip /tmp/terraform.zip && \
27+
mv ./terraform /usr/local/bin && \
28+
cd - && \
29+
rm -rf /tmp/terraform && \
30+
rm /tmp/terraform.zip
2031

2132
## AWS cli
2233
RUN apk add --no-cache \
@@ -71,7 +82,7 @@ RUN curl -fsSL https://clis.cloud.ibm.com/install/linux | sh && \
7182
ibmcloud plugin install container-service -f && \
7283
ibmcloud plugin install container-registry -f && \
7384
ibmcloud plugin install observe-service -f && \
74-
ibmcloud plugin install vpc-infrastructure -f && \
85+
if [[ "$TARGETPLATFORM" != "linux/arm64" ]]; then ibmcloud plugin install vpc-infrastructure -f; fi && \
7586
ibmcloud config --check-version=false
7687

7788
WORKDIR ${HOME}
@@ -110,7 +121,7 @@ RUN wget -q -O ./helm.tar.gz https://get.helm.sh/helm-v3.8.2-linux-$(if [[ "$TAR
110121
rmdir ./linux-$(if [[ "$TARGETPLATFORM" == "linux/arm64" ]]; then echo "arm64"; else echo "amd64"; fi) && \
111122
rm ./helm.tar.gz
112123

113-
RUN wget -q -O ./terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/v0.36.10/terragrunt_linux_$(if [[ "$TARGETPLATFORM" == "linux/arm64" ]]; then echo "arm64"; else echo "amd64"; fi) && \
124+
RUN wget -q -O ./terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_$(if [[ "$TARGETPLATFORM" == "linux/arm64" ]]; then echo "arm64"; else echo "amd64"; fi) && \
114125
chmod +x ./terragrunt && \
115126
sudo mv ./terragrunt /usr/bin/terragrunt
116127

0 commit comments

Comments
 (0)