Created
February 8, 2018 20:24
-
-
Save wehappyfew/008ea2ed277df33b2d9faf51ddb11350 to your computer and use it in GitHub Desktop.
Alpine image to control Kubernetes on Azure using Helm and Draft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Custom Dockerfile | |
# - based on Alpine linux | |
# - install AzureCLI v2.0 | |
# - install Helm [Kubernetes (more than) package manager] | |
# - install kubectl | |
# Usage: | |
# Build it and push it to the private registry. | |
# Gitlab will use it to interact with Azure Kubernetes and Registry [AKS, ACR] | |
# | |
FROM alpine | |
ENV HELM_LATEST_VERSION="v2.7.2" | |
# --- > TODO | |
#ENV AZURE_CLI_LATEST_VERSION="" | |
##### Notice: Install AzureCLI 2.0 ##### | |
RUN apk update && \ | |
apk add --no-cache git && \ | |
apk add bash curl make py-pip && \ | |
apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python2-dev && \ | |
pip install azure-cli && \ | |
apk del --purge build | |
##### Notice: Install Helm ##### | |
RUN apk add --update ca-certificates \ | |
&& apk add --update -t deps wget \ | |
&& wget http://storage.googleapis.com/kubernetes-helm/helm-${HELM_LATEST_VERSION}-linux-amd64.tar.gz \ | |
&& tar -xvf helm-${HELM_LATEST_VERSION}-linux-amd64.tar.gz \ | |
&& mv linux-amd64/helm /usr/local/bin \ | |
&& apk del --purge deps \ | |
&& rm /var/cache/apk/* \ | |
&& rm -f /helm-${HELM_LATEST_VERSION}-linux-amd64.tar.gz | |
##### Notice: Install kubectl ##### | |
# Note: Latest version may be found on: | |
# https://aur.archlinux.org/packages/kubectl-bin/ | |
ADD https://storage.googleapis.com/kubernetes-release/release/v1.6.4/bin/linux/amd64/kubectl /usr/local/bin/kubectl | |
ENV HOME=/config | |
RUN set -x && \ | |
apk add --no-cache curl ca-certificates && \ | |
chmod +x /usr/local/bin/kubectl && \ | |
\ | |
# Create non-root user (with a randomly chosen UID/GUI). | |
adduser kubectl -Du 2342 -h /config && \ | |
\ | |
# Basic check it works. | |
kubectl version --client | |
###### Notice: Install envsubst ##### | |
## check here: https://github.com/cirocosta/alpine-envsubst/blob/master/Dockerfile | |
## here: https://serverfault.com/questions/791715/using-environment-variables-in-kubernetes-deployment-spec | |
#RUN set -x && \ | |
# apk add --update libintl && \ | |
# apk add --virtual build_deps gettext && \ | |
# cp /usr/bin/envsubst /usr/local/bin/envsubst && \ | |
# apk del build_deps | |
####### Notice: Install Draft ##### | |
### check here: https://github.com/Azure/draft/blob/master/docs/install.md | |
### | |
#RUN curl https://azuredraft.blob.core.windows.net/draft/draft-canary-linux-amd64.tar.gz | tar xvz && \ | |
# cp linux-amd64/draft /usr/bin && \ | |
# rm -rf linux-amd64 | |
CMD ["sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment