I was able to install the google-cloud-sdk into my docker image (yay!) however I have to reference gcloud as ~/google-cloud-sdk/bin/gcloud - I cannot figure out how to get it into the path. The ./install.sh script is supposed to do it but it doesn’t.
We install the google cloud sdk like this: https://github.com/gitpod-io/gitpod/blob/master/dev/image/Dockerfile#L118
If that doesn’t help, please share more information like a snapshot or so (DM me if private).
Thanks! I think the ENV line is what I’d not figured out!
Follow-up question - is there an easier way to authenticate than gcloud auth login? That gives me a long url - which I have to cut and paste into a browser (it doesn’t seem to click) and then copy and paste an authentication string. Is there a way to create a persistent login in the docker image?
Bumping this one as this is one shows up when you google “gcloud sdk gitpod”, but the link points to master which for sure its now outdated. So I dived into the commit history and found this commit, which is likely the recommended suggestion from back then. Please correct if that isn’t the case!
UPDATE: As of Jun '21 Google suggests1 using the following one-liner command to install
gcloud in a Docker image:
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-sdk -y
Thanks to the great docs2 this was a piece of cake to test and deploy in our project. Good stuff!
Footnotes while my user can get permission to post more than 2 links