Here, we are creating a servive for auth proxy with a hello world docker image. This step is to get the service URL for configuration in later steps.
gcloud beta run deploy --image gcr.io/cloudrun/hello --region=us-central1 auth-proxy
# make sure you are making this endpoint public
Get the service url for auth proxy and set as an environment variable
export SERVICE_URL=https://auth-proxy-xxxxxxxxxxxx.a.run.app
export CLIENT_ID= ...
export CLIENT_SECRET= ...
Add your service url auth endpoint to the authorized redict URIs filed in your OAuth app. e.g. https://auth-proxy-xxxxxx.a.run.app/auth
export DST_SERVICE_URL=https://tensorboard-xxxxxxxx-uc.a.run.app
In this example, we are setting the destination service url to a tensorboard service running on cloud run. This is the service you want to proxy all the requests to.
./build_base_docker_image.sh
export PROJECT_NAME=$(gcloud config get-value project | head -n1)
export IMAGE_NAME=gcr.io/$PROJECT_NAME/oauth_proxy:latest
docker build -t $IMAGE_NAME .
docker push $IMAGE_NAME
gcloud beta run deploy auth-proxy \
--image=$IMAGE_NAME \
--region=us-central1 \
--update-env-vars=CLIENT_ID=$CLIENT_ID,CLIENT_SECRET=$CLIENT_SECRET,SERVICE_URL=$SERVICE_URL,DST_SERVICE_URL=$DST_SERVICE_URL