github.com/grafana/tanka@v0.26.1-0.20240506093700-c22cfc35c21a/Dockerfile (about) 1 # download kubectl 2 FROM golang:1.22.2-alpine as kubectl 3 RUN apk add --no-cache curl 4 RUN export VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) &&\ 5 export OS=$(go env GOOS) && \ 6 export ARCH=$(go env GOARCH) &&\ 7 curl -o /usr/local/bin/kubectl -L https://storage.googleapis.com/kubernetes-release/release/${VERSION}/bin/${OS}/${ARCH}/kubectl &&\ 8 chmod +x /usr/local/bin/kubectl 9 10 # build jsonnet-bundler 11 FROM golang:1.22.2-alpine as jb 12 WORKDIR /tmp 13 RUN apk add --no-cache git make bash &&\ 14 git clone https://github.com/jsonnet-bundler/jsonnet-bundler &&\ 15 ls /bin &&\ 16 cd jsonnet-bundler &&\ 17 make static &&\ 18 mv _output/jb /usr/local/bin/jb 19 20 FROM golang:1.22.2-alpine as helm 21 WORKDIR /tmp/helm 22 RUN apk add --no-cache jq curl 23 RUN export TAG=$(curl --silent "https://api.github.com/repos/helm/helm/releases/latest" | jq -r .tag_name) &&\ 24 export OS=$(go env GOOS) &&\ 25 export ARCH=$(go env GOARCH) &&\ 26 curl -SL "https://get.helm.sh/helm-${TAG}-${OS}-${ARCH}.tar.gz" > helm.tgz && \ 27 tar -xvf helm.tgz --strip-components=1 28 29 FROM golang:1.22.2-alpine as kustomize 30 WORKDIR /tmp/kustomize 31 RUN apk add --no-cache jq curl 32 # Get the latest version of kustomize 33 # Releases are filtered by their name since the kustomize repository exposes multiple products in the releases 34 RUN export TAG=$(curl --silent "https://api.github.com/repos/kubernetes-sigs/kustomize/releases" | jq -r '[ .[] | select(.name | startswith("kustomize")) ] | .[0].tag_name') &&\ 35 export VERSION_TAG=${TAG#*/} &&\ 36 export OS=$(go env GOOS) &&\ 37 export ARCH=$(go env GOARCH) &&\ 38 echo "https://github.com/kubernetes-sigs/kustomize/releases/download/${TAG}/kustomize_${VERSION_TAG}_${OS}_${ARCH}.tar.gz" && \ 39 curl -SL "https://github.com/kubernetes-sigs/kustomize/releases/download/${TAG}/kustomize_${VERSION_TAG}_${OS}_${ARCH}.tar.gz" > kustomize.tgz && \ 40 tar -xvf kustomize.tgz 41 42 FROM golang:1.22.2 as build 43 WORKDIR /app 44 COPY . . 45 RUN make static 46 47 # assemble final container 48 FROM alpine:3.18 49 RUN apk add --no-cache coreutils diffutils less git openssh-client 50 COPY --from=build /app/tk /usr/local/bin/tk 51 COPY --from=kubectl /usr/local/bin/kubectl /usr/local/bin/kubectl 52 COPY --from=jb /usr/local/bin/jb /usr/local/bin/jb 53 COPY --from=helm /tmp/helm/helm /usr/local/bin/helm 54 COPY --from=kustomize /tmp/kustomize/kustomize /usr/local/bin/kustomize 55 WORKDIR /app 56 ENTRYPOINT ["/usr/local/bin/tk"]