Skip to main content

targon deploy

The targon deploy command deploys an application to Targon from a local file.

targon deploy <APP_REFERENCE>

Arguments

APP_REFERENCE: A reference to the Targon application object you want to deploy, in the format path.to.file:app_object_name.

For example, if you have a file named main.py with a Targon app object named my_app, you would deploy it like this:

targon deploy main.py:my_app

Options

  • --name: You can provide an optional name for the deployment.

Example Workflow

# targon-sdk/examples/gettin_started/getting_started.py
import targon

app = targon.App("getting-started", image=targon.Image.debian_slim("3.12"))

@app.function()
def hello(message: str) -> dict[str, str]:
return {"message": message, "status": "success"}

Deploy the app:

targon deploy targon-sdk/examples/gettin_started/getting_started.py --name getting-started-demo

During deployment the CLI:

  1. Imports the App with import_app_from_ref (see targon.cli.deploy).
  2. Streams build status via the rich console helpers.
  3. Persists the deployment so it remains available after the command finishes.

When to Use

  • Promoting a staging build into production.
  • Rolling out updates to long-running services.
  • Automating deployments in CI/CD pipelines (targon deploy is scriptable).

For iterative development, use targon run to execute local entrypoints without creating persistent deployments.