From 10087f0198e3e83a8ae641c5d5cb69824ee43cf9 Mon Sep 17 00:00:00 2001 From: mima Date: Wed, 26 Jan 2022 09:44:01 +0100 Subject: [PATCH 1/3] https://github.com/T-Systems-MMS/docker-management-container/issues/16 --- Dockerfile.template | 5 +++++ README.MD | 1 + examples/.docker_build | 1 + 3 files changed, 7 insertions(+) diff --git a/Dockerfile.template b/Dockerfile.template index 7c11e65..2915aef 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -158,6 +158,7 @@ ARG WORKDIR=/root ARG PIP_REQUIREMENTS ARG ANSIBLE_REQUIREMENTS ARG AZ_CLI_EXTENSIONS +ARG CURL_INSTALL_SCRIPTS WORKDIR ${WORKDIR} @@ -175,6 +176,10 @@ RUN test -n "${ANSIBLE_REQUIREMENTS}" && \ RUN test -n "${AZ_CLI_EXTENSIONS}" && \ for AZ_CLI_EXTENSION in ${AZ_CLI_EXTENSIONS}; do az extension add -y --name ${AZ_CLI_EXTENSION}; done || : +## install scripts over curl +RUN test -n "${CURL_INSTALL_SCRIPTS}" && \ + for CURL_INSTALL_SCRIPT in ${CURL_INSTALL_SCRIPTS}; do curl -sL ${CURL_INSTALL_SCRIPT} | sh ; done || : + ###################################### Config ##################################### ARG WORKDIR=/root diff --git a/README.MD b/README.MD index 92f57b2..687965d 100644 --- a/README.MD +++ b/README.MD @@ -56,6 +56,7 @@ Install needed Tools within Management Container | PIP_REQUIREMENTS | no | | File which includes a list of pip packages to be installed | | ANSIBLE_REQUIREMENTS | no | | File which includes a list of ansible-galaxy collections to be installed | | AZ_CLI_EXTENSIONS | no | | List of azure-cli extenstions to be installed | +| CURL_INSTALL_SCRIPTS | no | | List of scripts which should be installed over curl | ### System Configuration diff --git a/examples/.docker_build b/examples/.docker_build index dbd4c0a..fbf01d9 100644 --- a/examples/.docker_build +++ b/examples/.docker_build @@ -11,3 +11,4 @@ GCLOUD_VERSION=latest PIP_REQUIREMENT="pip_requirement" ANSIBLE_REQUIREMENTS="ansible_requirements" AZ_CLI_EXTENSIONS="front-door" +CURL_INSTALL_SCRIPTS="install.mob.sh" From 8eec54b401e000b327344114476262afb495a464 Mon Sep 17 00:00:00 2001 From: mima Date: Wed, 26 Jan 2022 15:38:44 +0100 Subject: [PATCH 2/3] change to direct github api usage --- Dockerfile.template | 12 +++++++----- README.MD | 26 +++++++++++++------------- examples/.docker_build | 2 +- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index 2915aef..7281b46 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -49,6 +49,7 @@ ARG TERRAFORM_VERSION ARG AZ_CLI_VERSION ARG AWS_CLI_VERSION ARG GCLOUD_VERSION +ARG GITHUB_BINARIES WORKDIR /root/download @@ -153,12 +154,17 @@ gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg \n\ yum install -y ${GCLOUD} && \ yum clean all || : +## github binaries +RUN test -n "${GITHUB_BINARIES}" && \ + for GITHUB_BINARY in ${GITHUB_BINARIES}; do GITHUB_PACKAGE_VERSION="$(curl -sSL https://api.github.com/repos/${GITHUB_BINARY} | grep -Po '"browser_download_url": "\K.*linux_amd64.tar.gz?(?=\")')" && \ + mkdir github && curl -SsL --retry 5 "${GITHUB_PACKAGE_VERSION}" | tar xz -C ./github && \ + chmod -R +x github/* && mv github/* && /usr/local/bin/; done || : + ###################################### Tool Config ################################ ARG WORKDIR=/root ARG PIP_REQUIREMENTS ARG ANSIBLE_REQUIREMENTS ARG AZ_CLI_EXTENSIONS -ARG CURL_INSTALL_SCRIPTS WORKDIR ${WORKDIR} @@ -176,10 +182,6 @@ RUN test -n "${ANSIBLE_REQUIREMENTS}" && \ RUN test -n "${AZ_CLI_EXTENSIONS}" && \ for AZ_CLI_EXTENSION in ${AZ_CLI_EXTENSIONS}; do az extension add -y --name ${AZ_CLI_EXTENSION}; done || : -## install scripts over curl -RUN test -n "${CURL_INSTALL_SCRIPTS}" && \ - for CURL_INSTALL_SCRIPT in ${CURL_INSTALL_SCRIPTS}; do curl -sL ${CURL_INSTALL_SCRIPT} | sh ; done || : - ###################################### Config ##################################### ARG WORKDIR=/root diff --git a/README.MD b/README.MD index 687965d..3e20876 100644 --- a/README.MD +++ b/README.MD @@ -36,18 +36,19 @@ Further packages to install can be specified Install needed Tools within Management Container -| ARG | Required | Default | -| ----------------- | -------- | ------- | -| ANSIBLE_VERSION | no | latest | -| DOCKER_VERSION | no | latest | -| NOMAD_VERSION | no | latest | -| CONSUL_VERSION | no | latest | -| KUBECTL_VERSION | no | latest | -| HELM_VERSION | no | latest | -| TERRAFORM_VERSION | no | latest | -| AZ_CLI_VERSION | no | latest | -| AWS_CLI_VERSION | no | latest | -| GCLOUD_VERSION | no | latest | +| ARG | Required | Default | Description | | +| ----------------- | -------- | ------- | -------------------------------- | +| ANSIBLE_VERSION | no | latest | | +| DOCKER_VERSION | no | latest | | +| NOMAD_VERSION | no | latest | | +| CONSUL_VERSION | no | latest | | +| KUBECTL_VERSION | no | latest | | +| HELM_VERSION | no | latest | | +| TERRAFORM_VERSION | no | latest | | +| AZ_CLI_VERSION | no | latest | | +| AWS_CLI_VERSION | no | latest | | +| GCLOUD_VERSION | no | latest | | +| GITHUB_BINARIES | no | latest | List of packages to be installed | ## Tool Configuration / Add Specific extension @@ -56,7 +57,6 @@ Install needed Tools within Management Container | PIP_REQUIREMENTS | no | | File which includes a list of pip packages to be installed | | ANSIBLE_REQUIREMENTS | no | | File which includes a list of ansible-galaxy collections to be installed | | AZ_CLI_EXTENSIONS | no | | List of azure-cli extenstions to be installed | -| CURL_INSTALL_SCRIPTS | no | | List of scripts which should be installed over curl | ### System Configuration diff --git a/examples/.docker_build b/examples/.docker_build index fbf01d9..fc902d5 100644 --- a/examples/.docker_build +++ b/examples/.docker_build @@ -11,4 +11,4 @@ GCLOUD_VERSION=latest PIP_REQUIREMENT="pip_requirement" ANSIBLE_REQUIREMENTS="ansible_requirements" AZ_CLI_EXTENSIONS="front-door" -CURL_INSTALL_SCRIPTS="install.mob.sh" +GITHUB_BINARIES="remotemobprogramming/mob/releases/latest" From 72c968bc598933b82d94a5a3fa1b9d095897f23b Mon Sep 17 00:00:00 2001 From: mima Date: Wed, 26 Jan 2022 16:54:03 +0100 Subject: [PATCH 3/3] fix: mv binary issue --- Dockerfile.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index 7281b46..00932cc 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -157,8 +157,8 @@ gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg \n\ ## github binaries RUN test -n "${GITHUB_BINARIES}" && \ for GITHUB_BINARY in ${GITHUB_BINARIES}; do GITHUB_PACKAGE_VERSION="$(curl -sSL https://api.github.com/repos/${GITHUB_BINARY} | grep -Po '"browser_download_url": "\K.*linux_amd64.tar.gz?(?=\")')" && \ - mkdir github && curl -SsL --retry 5 "${GITHUB_PACKAGE_VERSION}" | tar xz -C ./github && \ - chmod -R +x github/* && mv github/* && /usr/local/bin/; done || : + mkdir ./github && curl -SsL --retry 5 "${GITHUB_PACKAGE_VERSION}" | tar xz -C ./github && \ + chmod -R +x ./github/* && mv ./github/* /usr/local/bin/; done || : ###################################### Tool Config ################################ ARG WORKDIR=/root