The following is a full reference for all the fields that can be set in a porter.yaml file.

  • version - the version of the porter.yaml file. The below documentation is for v2.
  • name - the name of the app.
  • services - a list of services for this app.
    • name - the unique ID of the resource.
    • type - the type of service - being one of web, worker, or job.
    • run - the run command for the service.
    • instances - the number of instances of the service to run.
    • cpuCores - the number of CPU cores to allocate to the service.
    • ramMegabytes - the amount of RAM to allocate to the service.
    • gpuCoresNvidia - the number of Nvidia GPU cores to allocate to the service.
    • port - the port that the service will listen on.
    • additional type-specific fields. See full reference for web, worker, and job services.
  • build - the build settings for the app. Only one of build or image can be set.
    • method - the build method for the app. Can be one of docker or pack.
    • context - the build context for the app.
    • dockerfile - the path to the Dockerfile for the app, if the method is docker.
    • builder - the builder image to use for the app, if the method is pack.
    • buildpacks - the buildpacks to use for the app, if the method is pack.
  • image - the image settings for the app. Only one of build or image can be set.
    • repository - the image repository.
    • tag - the image tag.
  • env - the environment variables for the app.
  • predeploy - the pre-deploy job for the app.
    • run - the run command for the pre-deploy job.
  • autoRollback - the auto-rollback settings for the app.
    • enabled - whether auto-rollback is enabled.

version

string - required

version: v2

name

string - optional

Either name must or the PORTER_APP_NAME environment variable must be set when running porter apply.

name: my-app

services

array - required

services:
  - name: web
    type: web
    run: python app.py
    instances: 1
    cpuCores: 1
    ramMegabytes: 1024
    port: 8080

build

object - optional

build:
  method: pack
  context: .
  builder: heroku/buildpacks:20
  buildpacks:
    - heroku/python

image

object - optional

image:
  repository: my-registry/my-app
  tag: latest

env

object - optional

env:
  PORT: 8080

predeploy

object - optional

predeploy:
  run: echo "predeploy"

autoRollback

object - optional

When this attribute is enabled, Porter will automatically rollback all services in the app to the latest previously successfully-deployed version if the any service of the new version fails to deploy.

autoRollback:
  enabled: true