# Dockerfile for kraken

FROM ppc64le/centos:8

FROM mcr.microsoft.com/azure-cli:latest as azure-cli

LABEL org.opencontainers.image.authors="Red Hat OpenShift Chaos Engineering"

ENV KUBECONFIG /root/.kube/config

# Copy azure client binary from azure-cli image
COPY --from=azure-cli /usr/local/bin/az /usr/bin/az

# Install dependencies
RUN yum install -y git python39 python3-pip jq gettext wget && \
    python3.9 -m pip install -U pip && \
    git clone https://github.com/redhat-chaos/krkn.git --branch v1.5.7 /root/kraken && \
    mkdir -p /root/.kube && cd /root/kraken && \
    pip3.9 install -r requirements.txt && \
    pip3.9 install virtualenv && \
    wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq

# Get Kubernetes and OpenShift clients from stable releases
WORKDIR /tmp
RUN wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz && tar -xvf openshift-client-linux.tar.gz && cp oc /usr/local/bin/oc && cp kubectl /usr/local/bin/kubectl

WORKDIR /root/kraken

ENTRYPOINT python3.9 run_kraken.py --config=config/config.yaml
