| FROM alpine |
| |
| # Ignore to update versions here |
| # docker build --no-cache --build-arg KUBECTL_VERSION=${tag} --build-arg HELM_VERSION=${helm} --build-arg KUSTOMIZE_VERSION=${kustomize_version} -t ${image}:${tag} . |
| ARG HELM_VERSION=2.17.0 |
| ARG KUBECTL_VERSION=1.19.16 |
| ARG KUSTOMIZE_VERSION=v3.8.1 |
| ARG KUBESEAL_VERSION=0.18.1 |
| |
| # Install helm (latest release) |
| # ENV BASE_URL="https://storage.googleapis.com/kubernetes-helm" |
| ENV BASE_URL="https://get.helm.sh" |
| ENV TAR_FILE="helm-v${HELM_VERSION}-linux-amd64.tar.gz" |
| RUN apk add --update --no-cache curl ca-certificates bash git && \ |
| curl -sL ${BASE_URL}/${TAR_FILE} | tar -xvz && \ |
| mv linux-amd64/helm /usr/bin/helm && \ |
| chmod +x /usr/bin/helm && \ |
| rm -rf linux-amd64 |
| |
| RUN helm init --client-only |
| |
| # add helm-diff |
| RUN helm plugin install https://github.com/databus23/helm-diff && rm -rf /tmp/helm-* |
| |
| # add helm-unittest |
| RUN helm plugin install https://github.com/quintush/helm-unittest && rm -rf /tmp/helm-* |
| |
| # add helm-push |
| RUN helm plugin install https://github.com/chartmuseum/helm-push && rm -rf /tmp/helm-* |
| |
| # Install kubectl (same version of aws esk) |
| RUN curl -sLO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \ |
| mv kubectl /usr/bin/kubectl && \ |
| chmod +x /usr/bin/kubectl |
| |
| # Install kustomize (latest release) |
| RUN curl -sLO https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \ |
| tar xvzf kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \ |
| mv kustomize /usr/bin/kustomize && \ |
| chmod +x /usr/bin/kustomize |
| |
| # Install eksctl (latest version) |
| RUN curl -sL "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp && \ |
| mv /tmp/eksctl /usr/bin && \ |
| chmod +x /usr/bin/eksctl |
| |
| # Install awscli |
| RUN apk add --update --no-cache python3 && \ |
| python3 -m ensurepip && \ |
| pip3 install --upgrade pip && \ |
| pip3 install awscli && \ |
| pip3 cache purge |
| |
| # https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html |
| # Install aws-iam-authenticator |
| RUN authenticator=$(aws --no-sign-request s3 ls s3://amazon-eks --recursive |grep aws-iam-authenticator$|grep amd64 |awk '{print $NF}' |sort -V|tail -1) && \ |
| aws --no-sign-request s3 cp s3://amazon-eks/${authenticator} /usr/bin/aws-iam-authenticator && \ |
| chmod +x /usr/bin/aws-iam-authenticator |
| |
| # Install jq |
| RUN apk add --update --no-cache jq yq |
| |
| # Install for envsubst |
| RUN apk add --update --no-cache gettext |
| |
| # Install kubeseal |
| RUN curl -L https://github.com/bitnami-labs/sealed-secrets/releases/download/v${KUBESEAL_VERSION}/kubeseal-${KUBESEAL_VERSION}-linux-amd64.tar.gz -o - | tar xz -C /usr/bin/ && \ |
| chmod +x /usr/bin/kubeseal |
| |
| WORKDIR /apps |
| COPY . . |
| |
| RUN chmod a+x deploy.sh |
| CMD ./deploy.sh |