Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

3.0 KB
Raw Blame
# Builds run as the pinned three-ws-build service account: the project's default
# compute service account was deleted, so an unpinned submit fails with
# "Unknown service account".
serviceAccount: projects/aerial-vehicle-466722-p5/serviceAccounts/[email protected]

substitutions:
  _REGION: us-central1
  _RUN_SA: avatar-reconstruction-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com
  _SERVICE: texture-service
  _REPO: texture-service
  _GCS_BUCKET: three-ws-avatar-reconstructions
  _WEIGHTS_BUCKET: three-ws-model-weights
  # Dedicated prefix for this worker's HuggingFace cache tree. WEIGHTS_DIR used to
  # point at the mount root, which is shared with every other worker's weights, so
  # a diffusers download would have written its cache tree into that shared root.
  _WEIGHTS_PREFIX: sdxl-texture
  _MIN_INSTANCES: "0"
  _MAX_INSTANCES: "2"

steps:
  - id: build
    name: gcr.io/cloud-builders/docker
    dir: workers/texture
    args:
      - build
      - --tag
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
      - --tag
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest
      - --cache-from
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest
      # Only the ControlNet is baked into the image (see the Dockerfile). The
      # SDXL base and inpaint checkpoints come from the staged weights prefix
      # below, so passing them here would be a build arg nothing reads.
      - --build-arg=CONTROLNET_MODEL=diffusers/controlnet-depth-sdxl-1.0
      - .

  - id: push
    name: gcr.io/cloud-builders/docker
    args:
      - push
      - --all-tags
      - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server

  - id: deploy
    name: gcr.io/google.com/cloudsdktool/cloud-sdk:slim
    entrypoint: gcloud
    args:
      - run
      - deploy
      - ${_SERVICE}
      - --image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
      - --region=${_REGION}
      - --service-account=${_RUN_SA}
      - --platform=managed
      - --port=8080
      - --gpu=1
      - --gpu-type=nvidia-l4
      - --no-gpu-zonal-redundancy
      - --no-cpu-throttling
      - --cpu=8
      - --memory=32Gi
      - --min-instances=${_MIN_INSTANCES}
      - --max-instances=${_MAX_INSTANCES}
      - --timeout=600
      - --allow-unauthenticated
      # No Cloud Storage FUSE volume: the loader stages weights with the storage
      # client (WEIGHTS_GCS_URI below), and a mount at /weights would only shadow
      # the ControlNet cache baked into the image at /opt/hf-cache.
      - --set-env-vars=GCS_BUCKET=${_GCS_BUCKET},WEIGHTS_DIR=/opt/hf-cache,MAX_CONCURRENT=1,WEIGHTS_GCS_URI=gs://${_WEIGHTS_BUCKET}/${_WEIGHTS_PREFIX},WEIGHTS_LOCAL_DIR=/tmp/${_WEIGHTS_PREFIX}
      - --set-secrets=API_KEY=avatar-reconstruction-key:latest

images:
  - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA
  - ${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:latest

options:
  machineType: E2_HIGHCPU_32
  logging: CLOUD_LOGGING_ONLY