Getting Started with porter.yaml

Writing a porter.yaml for your app is a great way to maintain a single source of truth on how your app should be built and deployed. Though this file is not required, it can reduce the time it takes to get started with a Porter app. Once you start creating your app in Porter and select a Github repository, Porter will automatically read your porter.yaml to prepopulate settings for your app’s services.

The configuration defined in porter.yaml takes precedent over any settings you configure in the Porter dashboard. For that reason, any values which are set in porter.yaml are read-only in the Porter dashboard.

Example porter.yaml

The following is an example of a v2 porter.yaml file, which is the latest version of the spec. This example covers many of the available fields, but not all of them. For a full list of configurable options, see the full reference.

version: v2
name: my-app

  - name: api
    type: web
    run: node index.js
    port: 8080
    cpuCores: 0.1
    ramMegabytes: 256
      enabled: true
      minInstances: 1
      maxInstances: 3
      memoryThresholdPercent: 60
      cpuThresholdPercent: 60
    private: false
      - name:
      enabled: true
      httpPath: /healthz
  - name: example-wkr
    type: worker
    run: echo 'work'
    port: 8081
    cpuCores: 0.1
    ramMegabytes: 256
    instances: 1
  - name: example-job
    type: job
    run: echo 'hello world'
    allowConcurrent: true
    cpuCores: 0.1
    ramMegabytes: 256
    cron: '*/10 * * * *'

  run: ls

	method: docker
	context: ./
	dockerfile: ./app/Dockerfile

  NODE_ENV: production