|
1 |
| -FROM python:3.11.10-slim |
| 1 | +FROM registry.access.redhat.com/ubi9/python-311:9.5-1743582312 |
2 | 2 |
|
3 |
| -RUN apt update -y && apt install -y curl gnupg2 unzip ssh |
| 3 | +USER 0 |
| 4 | +RUN dnf update -y && dnf install -y gnupg2 unzip openssh |
4 | 5 | RUN mkdir /etc/agent-benchmark
|
5 | 6 | RUN ln -sf /bin/bash /bin/sh
|
6 | 7 |
|
7 | 8 | # install `ansible-playbook`
|
| 9 | +RUN pip install --upgrade setuptools==70.0.0 |
8 | 10 | RUN pip install ansible-core jmespath kubernetes==31.0.0 --no-cache-dir passlib
|
9 |
| -RUN ansible-galaxy collection install kubernetes.core community.crypto |
10 | 11 | # install `helm`
|
11 |
| -RUN curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | tee /usr/share/keyrings/helm.gpg > /dev/null && \ |
12 |
| - apt install apt-transport-https --yes && \ |
13 |
| - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list && \ |
14 |
| - apt update && \ |
15 |
| - apt install -y helm |
| 12 | +RUN curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash |
16 | 13 | # install `jq`
|
17 |
| -RUN apt install -y jq |
| 14 | +RUN dnf install -y jq |
18 | 15 | # install `make`
|
19 |
| -RUN apt install -y make |
| 16 | +RUN dnf install -y make |
| 17 | + |
| 18 | +# identify architecture |
| 19 | +ENV ARCH=unknown |
| 20 | +RUN ARCH=$(uname -m) && \ |
| 21 | + case "$ARCH" in \ |
| 22 | + x86_64) ARCH=amd64 ;; \ |
| 23 | + aarch64) ARCH=arm64 ;; \ |
| 24 | + *) echo "unsupported architecture: $ARCH" && exit 1 ;; \ |
| 25 | + esac && \ |
| 26 | + echo "ARCH=$ARCH" >> /etc/environment |
| 27 | + |
20 | 28 | # install `kubectl`
|
21 |
| -RUN curl -LO https://dl.k8s.io/release/v1.31.0/bin/linux/$(dpkg --print-architecture)/kubectl && \ |
| 29 | +RUN source /etc/environment && \ |
| 30 | + curl -LO https://dl.k8s.io/release/v1.31.0/bin/linux/${ARCH}/kubectl && \ |
22 | 31 | chmod +x ./kubectl && \
|
23 | 32 | mv ./kubectl /usr/local/bin/kubectl
|
24 | 33 | # install `aws` (need this for using kubectl against AWS cluster)
|
25 | 34 | RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
|
26 | 35 | unzip awscliv2.zip && \
|
27 | 36 | ./aws/install
|
28 | 37 | # install `opa`
|
29 |
| -RUN curl -L -o opa https://github.com/open-policy-agent/opa/releases/download/v1.0.0/opa_linux_$(dpkg --print-architecture)_static && \ |
| 38 | +RUN source /etc/environment && \ |
| 39 | + curl -L -o opa https://github.com/open-policy-agent/opa/releases/download/v1.0.0/opa_linux_${ARCH}_static && \ |
30 | 40 | chmod +x ./opa && \
|
31 | 41 | mv ./opa /usr/local/bin/opa
|
32 | 42 |
|
| 43 | +RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config |
| 44 | + |
| 45 | +USER 1001 |
| 46 | +RUN ansible-galaxy collection install kubernetes.core community.crypto |
| 47 | + |
33 | 48 | WORKDIR /etc/ciso-task-scenarios
|
34 | 49 | ENV FOREGROUND=true
|
35 | 50 | ENV MAKEFLAGS=-s
|
36 | 51 | ENV KUBECONFIG=/etc/ciso-task-scenarios/kubeconfig.yaml
|
37 | 52 | ENV SHARED_WORKSPACE=/tmp/agent
|
38 | 53 |
|
39 |
| -RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config |
40 |
| - |
41 | 54 | COPY 1.gen-cis-b-k8s-kyverno ./1.gen-cis-b-k8s-kyverno
|
42 | 55 | COPY 2.gen-cis-b-k8s-kubectl-opa ./2.gen-cis-b-k8s-kubectl-opa
|
43 | 56 | COPY 3.gen-cis-b-rhel9-ansible-opa ./3.gen-cis-b-rhel9-ansible-opa
|
|
0 commit comments