Skip to main content

/docs-deploy - Deploy docs.coditect.ai

Automated build and deployment of the CODITECT documentation site to Cloud Run.

Usage

# Deploy with auto-generated version (v1.X.Y based on git)
/docs-deploy

# Deploy with specific version tag
/docs-deploy v1.6.0-feature-name

# Build only (no deploy)
/docs-deploy --build-only

# Deploy existing image (skip build)
/docs-deploy v1.5.0-workflows --deploy-only

# Dry run (show what would happen)
/docs-deploy --dry-run

# Project-scoped deployment (ADR-159)
/docs-deploy --project CUST-avivatec-fpa

System Prompt

EXECUTION DIRECTIVE: When the user invokes /docs-deploy, execute the following workflow:

Step 1: Validate Environment

# Verify we're in the docs-site directory or can find it
DOCS_SITE="${DOCS_SITE:-$(git rev-parse --show-toplevel)/submodules/cloud/coditect-cloud-infra/docs-site}"
[ -d "$DOCS_SITE" ] || { echo "ERROR: docs-site not found"; exit 1; }
cd "$DOCS_SITE"

# Verify gcloud is configured
gcloud config get-value project 2>/dev/null | grep -q coditect-cloud-infra || {
echo "ERROR: gcloud not configured for coditect-cloud-infra"
exit 1
}

Step 2: Determine Version

# If no version provided, auto-generate from git
if [ -z "$VERSION" ]; then
# Get latest tag or use commit count
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
COMMIT_COUNT=$(git rev-list --count HEAD)
VERSION="v1.${COMMIT_COUNT}.0-$(date +%Y%m%d)"
fi
echo "Version: $VERSION"

Step 3: Build & Deploy (using existing cloudbuild.yaml)

Cloudbuild Config: ~/PROJECTS/coditect-rollout-master/submodules/cloud/coditect-cloud-infra/docs-site/cloudbuild.yaml

# Build and deploy using cloudbuild.yaml (handles both steps)
gcloud builds submit \
--config ~/PROJECTS/coditect-rollout-master/submodules/cloud/coditect-cloud-infra/docs-site/cloudbuild.yaml \
--substitutions=_TAG=$VERSION \
--project coditect-cloud-infra

The cloudbuild.yaml includes:

  • Docker build with E2_HIGHCPU_32 machine type
  • Automatic push to Artifact Registry
  • Cloud Run deployment with optimized settings (1 CPU, 512Mi RAM)
  • Tags both $VERSION and latest

Step 4: Deploy Only (for existing images)

# Deploy existing image (skip build) - only with --deploy-only
gcloud run deploy docs-coditect \
--image us-central1-docker.pkg.dev/coditect-cloud-infra/coditect-docs/docs-coditect:$VERSION \
--region us-central1 \
--project coditect-cloud-infra \
--allow-unauthenticated

Step 5: Verify

# Verify deployment
curl -sL -o /dev/null -w "%{http_code}" "https://docs.coditect.ai/" | grep -q 200 && \
echo "✅ Deployment verified: https://docs.coditect.ai" || \
echo "❌ Deployment verification failed"

Configuration

SettingValue
Projectcoditect-cloud-infra
Regionus-central1
Servicedocs-coditect
Registryus-central1-docker.pkg.dev/coditect-cloud-infra/coditect-docs
Cloudbuild YAML~/PROJECTS/coditect-rollout-master/submodules/cloud/coditect-cloud-infra/docs-site/cloudbuild.yaml
Machine TypeE2_HIGHCPU_32 (32 vCPUs for faster builds)
Timeout40 minutes

Version Naming Convention

PatternExampleUse Case
vX.Y.Zv1.5.0Semantic version release
vX.Y.Z-featurev1.5.0-workflowsFeature deployment
vX.Y.Z-fixv1.5.1-hotfixBug fix
vX.Y.Z-YYYYMMDDv1.123.0-20260109Auto-generated

Examples

Standard Deployment

/docs-deploy v1.6.0-new-feature

Result: Builds image, deploys to Cloud Run, verifies at docs.coditect.ai

Quick Rebuild After Content Change

/docs-deploy v1.5.1-content-update

Test Build Without Deploy

/docs-deploy v1.6.0-test --build-only

Deploy Previously Built Image

/docs-deploy v1.5.0-workflows --deploy-only

Deployment History

Track deployments by listing Cloud Run revisions:

gcloud run revisions list --service docs-coditect --region us-central1 --project coditect-cloud-infra

Rollback

To rollback to a previous version:

gcloud run services update-traffic docs-coditect \
--to-revisions=docs-coditect-XXXXX-XXX=100 \
--region us-central1 \
--project coditect-cloud-infra

Troubleshooting

IssueSolution
Build timeoutIncrease --timeout or use larger machine type
Memory errorAdd NODE_OPTIONS="--max-old-space-size=8192" to Dockerfile
Permission deniedRun gcloud auth login and verify IAM roles
Image not foundCheck registry path and version tag

Script Location: Inline (no external script required) Cloud Build Config: docs-site/cloudbuild.yaml (optional) Last Deployed: v1.5.0-workflows (Jan 9, 2026)