As part of the build process, I need to download some python packages from my private gcs bucket and install them as part of the Dockerfile. This could be done using a multi-stage builds like this one:
FROM google/cloud-sdk:alpine as gcloud
WORKDIR /packages
RUN gsutil cp gs://... /packages
FROM python:3.7.0
COPY --from=gcloud /packages .
but I have big problem with injecting service account from my local machine so that gsutil will be able to perform copy. I tried capturing content of service account json via ARG but it does not work with cloudbuild substitutions due to its json format:
gcloud builds submit . --substitutions _SERVICE_ACCOUNT_CONTENT="$(cat path_to_service_account.json)"
I also though about shared volumes between steps but it does not work with docker build. Any ideas how can I do this with cloudbuild?