Skip to content

Instantly share code, notes, and snippets.

@rhoboro
Last active December 29, 2017 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhoboro/e27d24fa782a69865537a7a78e1c4823 to your computer and use it in GitHub Desktop.
Save rhoboro/e27d24fa782a69865537a7a78e1c4823 to your computer and use it in GitHub Desktop.
サービスアカウントgsutilを使う
# put service-account-key to ./credentials.json
# docker build -t image/gsutil:0.1 .
# docker run --rm -it image/gsutil:0.1 ls gs://your_backet
FROM alpine:3.7
RUN apk update && apk add python \
&& wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-180.0.0-linux-x86_64.tar.gz \
&& tar zxvf google-cloud-sdk-180.0.0-linux-x86_64.tar.gz \
&& ./google-cloud-sdk/install.sh \
&& google-cloud-sdk/bin/gcloud config set component_manager/disable_update_check true
COPY credentials.json ./credentials.json
RUN google-cloud-sdk/bin/gcloud auth activate-service-account --key-file credentials.json --project my-project
ENTRYPOINT ["google-cloud-sdk/bin/gsutil"]
CMD ["ls", "gs://mybacket"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment