From c9a82ef1dcce276a29d9ef53490e8f1a61dad13c Mon Sep 17 00:00:00 2001 From: Pavel Nosovets Date: Tue, 21 Jan 2020 15:30:01 +0300 Subject: [PATCH 1/5] Merged with kube-helm Dockerfile --- Dockerfile | 56 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6e4b1f1..1473598 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,21 @@ ARG HELM_VERSION -ARG S3_PLUGIN_VERSION -ARG GCS_PLUGIN_VERSION -ARG PUSH_PLUGIN_VERSION +ARG KUBE_VERSION="v1.14.3" +ARG ALPINE_VERSION=3.11 +ARG PYTHON_VERSION=3.8 +# SETUP FROM golang:latest as setup ARG HELM_VERSION -ARG S3_PLUGIN_VERSION -ARG GCS_PLUGIN_VERSION -ARG PUSH_PLUGIN_VERSION -RUN echo "HELM_VERSION is set to: ${HELM_VERSION}" && mkdir /temp -RUN curl -L "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o helm.tar.gz \ +ARG KUBE_VERSION +RUN curl -L "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o helm.tar.gz \ && tar -zxvf helm.tar.gz \ && mv ./linux-amd64/helm /usr/local/bin/helm \ - && bash -c 'if [[ "${HELM_VERSION}" == 2* ]]; then helm init --client-only; else echo "using helm3, no need to initialize helm"; fi' \ - && helm plugin install https://github.com/hypnoglow/helm-s3.git --version=${S3_PLUGIN_VERSION} \ - && helm plugin install https://github.com/nouney/helm-gcs.git --version=${GCS_PLUGIN_VERSION} \ - && helm plugin install https://github.com/chartmuseum/helm-push.git --version=${PUSH_PLUGIN_VERSION} - + && helm init --client-only \ + && helm plugin install https://github.com/hypnoglow/helm-s3.git \ + && helm plugin install https://github.com/nouney/helm-gcs.git \ + && helm plugin install https://github.com/chartmuseum/helm-push.git \ + && curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \ + && chmod +x /usr/local/bin/kubectl # Run acceptance tests COPY Makefile Makefile COPY bin/ bin/ @@ -26,17 +25,30 @@ RUN apt-get update \ && apt-get install -y python3-venv \ && make acceptance -FROM codefresh/kube-helm:${HELM_VERSION} + +# MAIN +FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} + +WORKDIR /config + ARG HELM_VERSION -COPY --from=setup /temp /root/.helm/* /root/.helm/ -COPY bin/* /opt/bin/ -RUN chmod +x /opt/bin/* -COPY lib/* /opt/lib/ +ENV HELM_VERSION ${HELM_VERSION} -# Install Python3 -RUN apk add --no-cache python3 \ +RUN echo "HELM_VERSION is set to: ${HELM_VERSION}" + +RUN apk add --update ca-certificates && update-ca-certificates \ + && apk add --update --no-cache curl bash jq make git openssl \ + && pip install yq \ + && rm /var/cache/apk/* \ + && rm -rf /tmp/* \ && rm -rf /root/.cache -ENV HELM_VERSION ${HELM_VERSION} +COPY --from=setup /usr/local/bin/helm /usr/local/bin/helm +COPY --from=setup /usr/local/bin/kubectl /usr/local/bin/kubectl + +RUN bash -c 'if [[ "${HELM_VERSION}" == 2* ]]; then helm init --client-only; else echo "using helm3, no need to initialize helm"; fi' + +COPY bin/* /opt/bin/ +COPY lib/* /opt/lib/ -ENTRYPOINT ["/opt/bin/release_chart"] \ No newline at end of file +ENTRYPOINT ["/opt/bin/release_chart"] From c205791530aaa62dfd432e95d6884062aa819984 Mon Sep 17 00:00:00 2001 From: Pavel Nosovets Date: Tue, 21 Jan 2020 16:15:25 +0300 Subject: [PATCH 2/5] Added echo to Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 1473598..8c116fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ ARG PYTHON_VERSION=3.8 FROM golang:latest as setup ARG HELM_VERSION ARG KUBE_VERSION +RUN echo "HELM_VERSION is set to: ${HELM_VERSION}" RUN curl -L "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o helm.tar.gz \ && tar -zxvf helm.tar.gz \ && mv ./linux-amd64/helm /usr/local/bin/helm \ From 78afb3181b8322683c5c1f114fc0c58b209f7e64 Mon Sep 17 00:00:00 2001 From: Pavel Nosovets Date: Tue, 21 Jan 2020 16:24:26 +0300 Subject: [PATCH 3/5] Updated helm release url --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8c116fc..388bdfc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ FROM golang:latest as setup ARG HELM_VERSION ARG KUBE_VERSION RUN echo "HELM_VERSION is set to: ${HELM_VERSION}" -RUN curl -L "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o helm.tar.gz \ +RUN curl -L "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o helm.tar.gz \ && tar -zxvf helm.tar.gz \ && mv ./linux-amd64/helm /usr/local/bin/helm \ && helm init --client-only \ From b3b31820d3beb725e798fcccfe7d9160978e6c3c Mon Sep 17 00:00:00 2001 From: Pavel Nosovets Date: Tue, 21 Jan 2020 16:29:39 +0300 Subject: [PATCH 4/5] Fixed helm init --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 388bdfc..1ad1fc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,12 +11,13 @@ RUN echo "HELM_VERSION is set to: ${HELM_VERSION}" RUN curl -L "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o helm.tar.gz \ && tar -zxvf helm.tar.gz \ && mv ./linux-amd64/helm /usr/local/bin/helm \ - && helm init --client-only \ + && curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \ + && chmod +x /usr/local/bin/kubectl +RUN bash -c 'if [[ "${HELM_VERSION}" == 2* ]]; then helm init --client-only; else echo "using helm3, no need to initialize helm"; fi' \ && helm plugin install https://github.com/hypnoglow/helm-s3.git \ && helm plugin install https://github.com/nouney/helm-gcs.git \ && helm plugin install https://github.com/chartmuseum/helm-push.git \ - && curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \ - && chmod +x /usr/local/bin/kubectl + # Run acceptance tests COPY Makefile Makefile COPY bin/ bin/ From fd3161dec024e44c2f27756a753d5f6e9a6bc85c Mon Sep 17 00:00:00 2001 From: Pavel Nosovets Date: Tue, 21 Jan 2020 18:50:02 +0300 Subject: [PATCH 5/5] Added bash to setup build --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ad1fc4..60b1243 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,11 @@ ARG PYTHON_VERSION=3.8 # SETUP FROM golang:latest as setup ARG HELM_VERSION +ENV HELM_VERSION ${HELM_VERSION} ARG KUBE_VERSION RUN echo "HELM_VERSION is set to: ${HELM_VERSION}" -RUN curl -L "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o helm.tar.gz \ +RUN apt update && apt install -y bash \ + && curl -L "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o helm.tar.gz \ && tar -zxvf helm.tar.gz \ && mv ./linux-amd64/helm /usr/local/bin/helm \ && curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \ @@ -16,7 +18,7 @@ RUN curl -L "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" -o he RUN bash -c 'if [[ "${HELM_VERSION}" == 2* ]]; then helm init --client-only; else echo "using helm3, no need to initialize helm"; fi' \ && helm plugin install https://github.com/hypnoglow/helm-s3.git \ && helm plugin install https://github.com/nouney/helm-gcs.git \ - && helm plugin install https://github.com/chartmuseum/helm-push.git \ + && helm plugin install https://github.com/chartmuseum/helm-push.git # Run acceptance tests COPY Makefile Makefile