The nanoctl deploy command publishes a compiled nanoservice to the NanoServices platform, making it available for execution within your workflows. You can deploy an already-built artifact or let the CLI handle the build process automatically using the --build flag.

This command is flexible enough to support local development, production deployments, and integration into CI/CD pipelines. It allows you to define the service name, source directory, and whether to trigger a build as part of deployment—all through a straightforward CLI interface.

Whether you’re deploying from the current directory, a specific build path, or as part of an automated script, nanoctl deploy provides a consistent, reliable way to push your nanoservice live.

Deploy Nanoservice

Syntax

npx nanoctl deploy [options]

Deploys a nanoservice to the NanoServices platform, optionally building it first.

Options:

  • --name, -n (string): Service name (required). Default: none.
  • --build (boolean): Build before deploying. Default: false.
  • --directory, -d (string): Source directory path. Default: Current working directory.
  • --help, -h (boolean): Show help. Default: false.

Commands:

  • .: Deploy from the current directory.

Examples

Deploy with build:

npx nanoctl deploy -n my-service --build

Deploy existing build:

npx nanoctl deploy -n my-service -d ./build-output

Deploy from current directory:

npx nanoctl deploy -n my-service .




Build and Deploy Example

Build and deploy workflow:

# Build first
npx nanoctl build -d ./src

# Then deploy
npx nanoctl deploy -n my-service -d ./src

Single-command build & deploy:

npx nanoctl deploy -n my-service --build

CI/CD Pipeline Example:

# In your deployment script
npx nanoctl build -d $CODE_DIR
npx nanoctl deploy -n $SERVICE_NAME -d $CODE_DIR