Skip to main content
Prerequisites

porter apply

The porter apply command creates or updates applications by either applying a porter.yaml configuration file or rebuilding existing applications with their current configuration.

Usage Patterns

# Apply a porter.yaml configuration file
porter apply -f porter.yaml

# Rebuild existing app without a configuration file
porter apply --app my-app

# Use environment variables (useful in CI/CD)
export PORTER_APP_NAME=my-app
porter apply
By default, the command runs from a git repository and uses the current commit SHA as the image tag.

Configuration Precedence

Configuration values are resolved in the following order (highest priority first):
  1. Command-line flags
  2. Environment variables
  3. Values in porter.yaml
Key Environment Variables:
  • PORTER_APP_NAME or PORTER_STACK_NAME - Application name (replaces --app flag)
  • PORTER_PROJECT - Project ID
  • PORTER_CLUSTER - Cluster ID
  • PORTER_NAMESPACE - Kubernetes namespace
  • PORTER_TAG - Image tag (defaults to git commit SHA)

Common Flags

Build Control:
  • --build-method [docker|pack] - Build method
  • --build-context PATH - Build context directory
  • --dockerfile PATH - Dockerfile path (for docker builds)
  • --builder NAME - Builder for pack builds
  • --attach-buildpacks LIST - Buildpacks for pack builds
  • --no-build - Skip building a new image
  • --tag TAG - Override image tag
Configuration:
  • --variables KEY=VALUE,... - Set environment variables
  • --secrets KEY=VALUE,... - Set secret environment variables
  • --attach-env-groups LIST - Attach environment groups
  • --helm-overrides-file PATH - Helm value overrides file
Deployment:
  • --target NAME - Deployment target
  • --preview - Deploy as preview environment
  • --wait - Wait for deployment completion
  • --exact - Apply exact configuration (don’t merge with existing)
  • --predeploy - Run predeploy job
Validation:
  • --validate - Validate porter.yaml without deploying
  • --dry-run - Server-side validation without building/deploying