App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.
App Platform supports two ways to build an image for your app: Cloud Native Buildpacks and Dockerfiles.
When you give App Platform access to your code, it defaults to using a Dockerfile if one is present in the root of the directory or specified in the app spec. Otherwise, App Platform checks your code to determine what language or framework it uses. If it supports the language or framework, it chooses an appropriate resource type and uses the proper buildpack to build the app and deploy a container.
App Platform looks for any of the following files to detect a Go application:
go.mod
Gopkg.toml
Godeps/Godeps.json
vendor/vendor.json
glide.yaml
If App Platform detects one of these files, it guides you through the remaining configuration and then builds the app with the appropriate buildpack.
App Platform uses the heroku-buildpack-go buildpack for detecting and building Golang applications.
App Platform uses version 192
of the Heroku Go Buildpack. The buildpack supports Go runtime versions 1.11
up to 1.22
. If no version is specified in your app, App Platform defaults to using version 1.13
.
App Platform offers the v1 and v0 version of the Go buildpack. To start using Go v1, we recommend upgrading your stack to Ubuntu-22 before upgrading to newer Go buildpack versions. To see specific runtimes that are available for these versions, please look at our release notes.
The buildpack supports the following Go runtime versions:
App Platform automatically uses the Go version specified in your go.mod
file:
module github.com/digitalocean/sample-golang
go 1.16
...
Go apps that do not use a supported package manager may fail to build.
App Platform supports the following package managers: Go modules, dep, Godep, govendor, and Glide.
Go apps with dependencies in private git repos may fail to build.
The instructions in Heroku’s documentation for configuring authentication with private git repos for their Go buildpack will also work in App Platform. Alternatively, you can vendor the dependencies into the repository.
If your Go app uses private dependencies that are not accessible with the same account used to access the apps, you can inject a personal access token by setting the value of the GO_GIT_CRED__HTTPS__GITHUB__COM
environment variable to your GitHub personal access token. Learn more in Heroku’s documentation on private git repository credentials.