Skip to main content
This is the complete reference for all fields that can be set in a porter.yaml file.

Top-Level Fields

You must specify either build or image, but not both. Use build when Porter should build your container image, or image when using a pre-built image from a registry.

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.
We recommend defining a Dockerfile over using buildpacks - if you’re not sure which to use, default to creating a Dockerfile for your application. For more information about creating a Dockerfile, you can look here.
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.
See Predeploy Configuration for more details.

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.
When enabled, Porter automatically rolls back all services to the last successfully deployed version if any service fails to deploy.

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