Skip to content

Instantly share code, notes, and snippets.

@oxlb
Created July 14, 2021 14:34
Show Gist options
  • Save oxlb/da4beebd399dfed5e20bf2a16710eded to your computer and use it in GitHub Desktop.
Save oxlb/da4beebd399dfed5e20bf2a16710eded to your computer and use it in GitHub Desktop.
cloud-spanner
version: '3'
services:
spanner:
image: gcr.io/cloud-spanner-emulator/emulator:latest
ports:
- "9010:9010"
- "9020:9020"
gcloud-spanner-init:
image: gcr.io/google.com/cloudsdktool/cloud-sdk:latest
environment:
PROJECT_ID: "spanner-project"
SPANNER_EMULATOR_URL: "http://spanner:9020/"
INSTANCE_NAME: "spanner-instance"
DATABASE_NAME: "spanner-database"
command: >
bash -c 'gcloud config configurations create emulator &&
gcloud config set auth/disable_credentials true &&
gcloud config set project $${PROJECT_ID} &&
gcloud config set api_endpoint_overrides/spanner $${SPANNER_EMULATOR_URL} &&
gcloud config set auth/disable_credentials true &&
gcloud spanner instances create $${INSTANCE_NAME} --config=emulator-config --description=Emulator --nodes=1
gcloud spanner databases create $${DATABASE_NAME} --instance=$${INSTANCE_NAME}'
spanner-cli:
image: sjdaws/spanner-cli:latest
environment:
SPANNER_EMULATOR_HOST: "spanner:9010"
depends_on:
- "gcloud-spanner-init"
command: ['sh', '-c', 'echo spanner client.... && tail -f /dev/null']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment