Examples
Basic Web Application
In this example, we’ll walk through an example of enabling preview environments for a simple Go application, built via a cloud-native buildpack. The sample repository can be found here.
porter.yaml
File Walkthrough
The porter.yaml
file for this application is as follows:
version: "v1"
resources:
- name: "go-sample"
source:
name: "web"
config:
build:
method: "pack"
values:
container:
command: "go-getting-started"
port: 8080
env:
normal:
BPE_PORT: "8080"
BP_KEEP_FILES: "static/*"
source
: By only setting thesource.name
field toweb
, Porter will deploy this as aweb
application.config.build
: specifying theconfig.build.method
field aspack
instructs Porter to build this application using cloud-native buildpacks.config.values
: here, we set common configuration settings, such as the start command, the port that the application runs on, and environment variables for the application.