Skip to content

Instantly share code, notes, and snippets.

@arn-ob
Last active September 17, 2023 09:13
Show Gist options
  • Save arn-ob/157f9b2c2ddbb6b9d7c40d046ed3f9b2 to your computer and use it in GitHub Desktop.
Save arn-ob/157f9b2c2ddbb6b9d7c40d046ed3f9b2 to your computer and use it in GitHub Desktop.
kubernetes and gcloud cli install in dockerfile
# Use an official Ubuntu image as the base image
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary dependencies and tools
RUN apt-get update && apt-get install -y \
curl tcl python3 python3-pip tzdata curl git htop \
man unzip vim wget tar python2 python3 nano nodejs
#### kubernetes ####
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
RUN curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin
# Install the Google Cloud SDK
RUN curl -sSL https://sdk.cloud.google.com | bash
# Set default Google Cloud project and region (replace with your values)
ENV GOOGLE_PROJECT <project_name>
ENV GOOGLE_REGION <region_name>
RUN echo 'alias gcloud=/root/google-cloud-sdk/bin/gcloud' >> ~/.bashrc
ENV PATH=$PATH:/root/google-cloud-sdk/bin
# Run the Google Cloud SDK installer
RUN /root/google-cloud-sdk/bin/gcloud config set project <project_id>
# infinity loop
ENTRYPOINT sleep infinity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment