Skip to content

Commit 68f381e

Browse files
authored
chore: update CISO Dockerfile base image (#40)
--------- Signed-off-by: Takumi Yanagawa <yana@jp.ibm.com>
1 parent 58070ee commit 68f381e

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ updates:
99
- package-ecosystem: docker
1010
directories:
1111
- sre/tools/**/
12+
- ciso/Dockerfile
1213
schedule:
1314
interval: weekly
1415

ciso/Dockerfile

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,56 @@
1-
FROM python:3.11.10-slim
1+
FROM registry.access.redhat.com/ubi9/python-311:9.5-1743582312
22

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
45
RUN mkdir /etc/agent-benchmark
56
RUN ln -sf /bin/bash /bin/sh
67

78
# install `ansible-playbook`
9+
RUN pip install --upgrade setuptools==70.0.0
810
RUN pip install ansible-core jmespath kubernetes==31.0.0 --no-cache-dir passlib
9-
RUN ansible-galaxy collection install kubernetes.core community.crypto
1011
# 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
1613
# install `jq`
17-
RUN apt install -y jq
14+
RUN dnf install -y jq
1815
# 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+
2028
# 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 && \
2231
chmod +x ./kubectl && \
2332
mv ./kubectl /usr/local/bin/kubectl
2433
# install `aws` (need this for using kubectl against AWS cluster)
2534
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
2635
unzip awscliv2.zip && \
2736
./aws/install
2837
# 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 && \
3040
chmod +x ./opa && \
3141
mv ./opa /usr/local/bin/opa
3242

43+
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
44+
45+
USER 1001
46+
RUN ansible-galaxy collection install kubernetes.core community.crypto
47+
3348
WORKDIR /etc/ciso-task-scenarios
3449
ENV FOREGROUND=true
3550
ENV MAKEFLAGS=-s
3651
ENV KUBECONFIG=/etc/ciso-task-scenarios/kubeconfig.yaml
3752
ENV SHARED_WORKSPACE=/tmp/agent
3853

39-
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
40-
4154
COPY 1.gen-cis-b-k8s-kyverno ./1.gen-cis-b-k8s-kyverno
4255
COPY 2.gen-cis-b-k8s-kubectl-opa ./2.gen-cis-b-k8s-kubectl-opa
4356
COPY 3.gen-cis-b-rhel9-ansible-opa ./3.gen-cis-b-rhel9-ansible-opa

0 commit comments

Comments
 (0)