# Use UBI9 as the base image FROM registry.access.redhat.com/ubi9/ubi:latest # Install necessary packages RUN dnf update -y && \ dnf install -y ansible git && \ dnf clean all # Install Helm RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash # Install Ansible required collections RUN ansible-galaxy collection install kubernetes.core community.general # Create a directory for Ansible playbooks WORKDIR /ansible # Copy the playbooks to the container COPY ./ansible /ansible # Set up environment variable for API token ARG API_TOKEN ENV API_TOKEN=${API_TOKEN} # Install additional Ansible dependencies RUN ansible-galaxy collection install \ kubernetes.core.helm \ community.general.terraform \ kubernetes.core.k8s # Mount a volume to output logs VOLUME ["/output_logs"] # Command to run Ansible playbook and output logs to mounted directory CMD ["bash", "-c", "ansible-playbook -i inventory playbook.yml --extra-vars \"api_token=${API_TOKEN}\" | tee /output_logs/playbook_output.log"]