-
Notifications
You must be signed in to change notification settings - Fork 753
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (34 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
38 lines (34 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FROM python:3.12-alpine
LABEL maintainer="Rhino Assessment Team <cloudgoat@rhinosecuritylabs.com>"
LABEL cloudgoat.version="2.5.0"
# Install bash, necessary tools, AWS CLI, and Terraform in a single layer
RUN apk add --no-cache \
bash \
bash-completion \
docker-bash-completion \
openssh \
curl \
unzip \
# Install jq to parse JSON and detect architecture
jq \
# Detect architecture
&& ARCH=$(uname -m) \
&& case "$ARCH" in \
x86_64) DOWNLOAD_URL="https://releases.hashicorp.com/terraform/1.11.2/terraform_1.11.2_linux_amd64.zip" ;; \
i686) DOWNLOAD_URL="https://releases.hashicorp.com/terraform/1.11.2/terraform_1.11.2_linux_386.zip" ;; \
aarch64) DOWNLOAD_URL="https://releases.hashicorp.com/terraform/1.11.2/terraform_1.11.2_linux_arm64.zip" ;; \
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac \
# Download Terraform based on architecture
&& wget -O terraform.zip $DOWNLOAD_URL \
# Extract Terraform directly to /usr/bin
&& unzip terraform.zip -d /usr/bin/ \
# Remove the downloaded zip file to keep the image smaller
&& rm terraform.zip \
# Install AWS CLI without cache to reduce image size
&& pip3 install --no-cache-dir awscli==1.38.11 --upgrade
# Install CloudGoat
WORKDIR /usr/src/cloudgoat/
COPY ./ ./
RUN pip3 install --no-cache-dir .
ENTRYPOINT ["/bin/bash"]