porter.yaml file.
Top-Level Fields
version
string
Required
The schema version. Must be v2.
name
string
Required (unless PORTER_APP_NAME is set)
The application name. Must be 31 characters or less, consist of lowercase alphanumeric characters or -, and start and end with an alphanumeric character.
build
object
Optional
Configuration for building container images. Cannot be used together with image.
For available
builder and buildpacks values, see the Cloud Native Buildpacks Registry or Paketo Builders Reference documentation. Common builders include heroku/builder:24 and paketobuildpacks/builder-jammy-full:latest.image
object
Optional
Configuration for using a pre-built container image. Cannot be used together with build.
env
object
Optional
Environment variables to set for all services. Values must be strings.
For sensitive values, use environment groups instead of hardcoding them in
porter.yaml.envGroups
string[]
Optional
Names of environment groups to attach to the application. Environment groups are project-wide and must already exist before deploying.
predeploy
object
Optional
A job that runs before deploying services. Commonly used for database migrations.
initialDeploy
object
Optional
A job that runs only on the first deployment of a preview environment. Useful for one-time setup tasks like database seeding.
autoRollback
object
Optional
Configure automatic rollback when deployments fail.
efsStorage
object
Optional
Enable AWS EFS (Elastic File System) storage for persistent data. Only available on AWS clusters.
services
array
Required
List of service definitions. Each service represents a deployable unit of your application.
Common Service Fields
These fields apply to all service types:Service Types
Basic Example
connections
array
Optional
Configure connections to external cloud services. See Connections Configuration for full documentation.
AWS Role Connection
Attach an IAM role to your service for AWS API access.Azure Managed Identity Connection
Bind a User Assigned Managed Identity to your service for Azure API access via Azure Workload Identity.GCP Service Account Connection
Bind a GCP IAM service account to your service for GCP API access without service account key files.Cloud SQL Connection (GCP)
Connect to Google Cloud SQL instances.Persistent Disk Connection
Attach persistent storage to your service.gpu
object
Optional
Configure GPU resources for machine learning workloads.
GPU workloads require a node group with GPU-enabled instances.
metricsScraping
object
Optional
Configure Prometheus metrics scraping for custom application metrics.
Complete Example
Related Documentation
- Web Services - Web service configuration
- Worker Services - Worker service configuration
- Job Services - Job service configuration
- Predeploy Jobs - Pre-deploy job configuration
- Autoscaling Configuration - Autoscaling configuration reference
- Connections Configuration - Cloud connections reference
- porter apply - CLI reference for deployments

