Skip to main content

Code Deployment

Using the deploy command, you can deploy local project code to the Cloud Run environment.

Basic Usage

tcb cloudrun deploy

Usage Example:

# Interactive Deployment. The CLI will guide you through selecting services and environments.
tcb cloudrun deploy

# Deploy the code in the current directory to the specified service
tcb cloudrun deploy -e env-123456 -s my-service

# Deploy container-based services and specify the port
tcb cloudrun deploy -e env-123456 -s api-service --port 8080

# Deploy the code in the specified directory
tcb cloudrun deploy -e env-123456 -s my-service --source ./dist

# Force deployment and skip confirmation prompts
tcb cloudrun deploy -e env-123456 -s my-service --force

Create and Deploy an Agent

tcb cloudrun deploy -e <envId> --createAgent

Usage Example:

# Create a function-based Agent and deploy dependent function services
tcb cloudrun deploy -e env-123456 --createAgent

# Create an Agent and force deployment
tcb cloudrun deploy -e env-123456 --createAgent --force

Command Line Parameters

ParameterDescriptionRequired
-e, --env-idEnvironment IDNo
-s, --serviceNameService nameNo
--portListening port for container services (this parameter is invalid for function services)No
--sourcePath to the directory containing the deployment code (absolute or relative path, default: current directory)No
--createAgentCreates a function-based Agent and simultaneously deploys the dependent function-based Cloud Run serviceNo
--forceForce deployment and skip all confirmation promptsNo
--dry-runPerform a dry run to validate code loading and configuration without actual deploymentNo
-h, --helpDisplay command help informationNo

Precautions

  • Ensure that the code has passed local testing before deployment
  • For container services, the --port parameter must be specified; for function services, it does not need to be specified
  • Using --source allows you to deploy code from non-current directories
  • It is recommended to first use tcb cloudrun run for local testing
  • Cloud Run code project sample: nodejs_hello_world