From 1c0c3d20a1c483dde7506f0a9b57cceba03201b2 Mon Sep 17 00:00:00 2001 From: Rebecca Valente Date: Wed, 11 Sep 2024 14:51:49 -0300 Subject: [PATCH] add initial Dockerfile --- Dockerfile | 78 +++++++++++++++++++++++ rootfs/etc/ansible/ansible.cfg | 33 ++++++++++ rootfs/etc/apt/sources.list.d/extras.list | 1 + rootfs/tmp/ansible/.gitkeep | 0 rootfs/tmp/ansible/retry/.gitkeep | 0 5 files changed, 112 insertions(+) create mode 100644 Dockerfile create mode 100644 rootfs/etc/ansible/ansible.cfg create mode 100644 rootfs/etc/apt/sources.list.d/extras.list create mode 100644 rootfs/tmp/ansible/.gitkeep create mode 100644 rootfs/tmp/ansible/retry/.gitkeep diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f16efaf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,78 @@ +FROM debian:12 +ENV DEBIAN_FRONTEND=noninteractive + +USER root + +WORKDIR /app + +COPY rootfs/ / + +RUN apt update -qq -y >/dev/null 2>&1 \ +&& apt install -qq -y \ + jq \ + git \ + zip \ + curl \ + bash \ + make \ + gnupg \ + openssl \ + ca-certificates \ + docker-ce \ + docker-ce-cli \ + containerd.io \ + docker-buildx-plugin \ + docker-compose-plugin \ + python3-pip \ + python3-apt \ + python3-distutils \ +&& apt autoclean -y \ +&& apt autoremove -y \ +&& rm -rf /var/lib/apt/lists/* + +RUN git clone --depth=1 https://github.com/tfutils/tfenv.git ./tfenv \ +&& chmod +x ./tfenv/bin/* \ +&& mv ./tfenv/bin/* /usr/local/bin + +RUN git clone --depth=1 https://github.com/cunymatthieu/tgenv.git ./tgenv \ +&& chmod +x ./tgenv/bin/* \ +&& mv ./tgenv/bin/* /usr/local/bin + +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ +&& unzip awscliv2.zip \ +&& ./aws/install + +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash + +ENV N_PREFIX=/app/n +RUN curl -L https://bit.ly/n-install | bash -s -- -y +ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/n/bin + + +RUN curl -s https://api.github.com/repos/little-angry-clouds/kubernetes-binaries-managers/releases/latest \ +| jq -r '.assets[] | select(.browser_download_url | contains ("linux_amd64")) | .browser_download_url' \ +| xargs curl -sLo kbenv.tar.gz \ +&& tar -zxvf kbenv.tar.gz \ +&& mv kubectl-linux-amd64/kbenv /usr/bin/kbenv \ +&& mv kubectl-linux-amd64/kubectl-wrapper /usr/bin/kubectl \ +&& mv helm-linux-amd64/helmenv /usr/bin/helmenv \ +&& mv helm-linux-amd64/helm-wrapper /usr/bin/helm + +ENV KUBECTL_VERSION=1.28.2 +ENV HELM_VERSION=3.15.4 +RUN /usr/bin/kbenv install ${KUBECTL_VERSION} \ +&& /usr/bin/kbenv use ${KUBECTL_VERSION} \ +&& /usr/bin/helmenv install ${HELM_VERSION} \ +&& /usr/bin/helmenv use ${HELM_VERSION} + +ENV TF_VERSION=1.9.5 +RUN tfenv install ${TF_VERSION} \ +&& tfenv use ${TF_VERSION} + +ENV TG_VERSION=0.56.5 +RUN tgenv install ${TG_VERSION} \ +&& tgenv use ${TG_VERSION} + +ENV ANSIBLE_VERSION=10.4.0 +RUN pip3 install ansible==${ANSIBLE_VERSION} + diff --git a/rootfs/etc/ansible/ansible.cfg b/rootfs/etc/ansible/ansible.cfg new file mode 100644 index 0000000..1b3a673 --- /dev/null +++ b/rootfs/etc/ansible/ansible.cfg @@ -0,0 +1,33 @@ +[defaults] +forks=1024 +internal_poll_interval = 0.1 + +timeout=300 +gathering = smart +pipelining = true +remote_user = root +any_errors_fatal = true +host_key_checking = true +retry_files_save_path = /tmp/ansible/retry/ + +fact_caching = community.general.yaml +fact_caching_timeout = 7200 +fact_caching_connection = /tmp/ansible/cache + +stdout_callback = dense +callbacks_enabled = timer, profile_tasks +callback_whitelist = timer, profile_tasks + +action_warnings = false +command_warnings = false +deprecation_warnings = false + +ansible_managed = "This file is managed by Ansible. Any modifications are subject to overwriting." + +[callback_log_plays] +log_folder = /tmp/ansible/hosts + +[ssh_connection] +retries = 2 +ssh_args = "-C -A -o ControlMaster=auto -o ControlPersist=300s -o PreferredAuthentications=publickey,password -o ForwardAgent=yes" +pipelining = true diff --git a/rootfs/etc/apt/sources.list.d/extras.list b/rootfs/etc/apt/sources.list.d/extras.list new file mode 100644 index 0000000..450e46e --- /dev/null +++ b/rootfs/etc/apt/sources.list.d/extras.list @@ -0,0 +1 @@ +deb https://download.docker.com/linux/debian "bookworm" stable diff --git a/rootfs/tmp/ansible/.gitkeep b/rootfs/tmp/ansible/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/tmp/ansible/retry/.gitkeep b/rootfs/tmp/ansible/retry/.gitkeep new file mode 100644 index 0000000..e69de29