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
| Parameter | Description | Required |
|---|---|---|
-e, --env-id | Environment ID | No |
-s, --serviceName | Service name | No |
--port | Listening port for container services (this parameter is invalid for function services) | No |
--source | Path to the directory containing the deployment code (absolute or relative path, default: current directory) | No |
--createAgent | Creates a function-based Agent and simultaneously deploys the dependent function-based Cloud Run service | No |
--force | Force deployment and skip all confirmation prompts | No |
--dry-run | Perform a dry run to validate code loading and configuration without actual deployment | No |
-h, --help | Display command help information | No |
Precautions
- Ensure that the code has passed local testing before deployment
- For container services, the
--portparameter must be specified; for function services, it does not need to be specified - Using
--sourceallows you to deploy code from non-current directories - It is recommended to first use
tcb cloudrun runfor local testing - Cloud Run code project sample: nodejs_hello_world