You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cd samples/go/mod
$ echo "web: /cnb/process/mod" > Procfile
$ pack build mod-sample --buildpack paketo-buildpacks/go
latest: Pulling from paketobuildpacks/builder-jammy-full
Digest: sha256:c635adc0fc34f742ceadbee6d84b7bae0988c69aa63186ef768866e7d171cdd4
Status: Image is up to date for paketobuildpacks/builder-jammy-full:latest
latest: Pulling from paketobuildpacks/run-jammy-full
Digest: sha256:29b8d6d812630b52b3bad6c83b108cc437e959d4cc7e4a94c0de927e9e9cb2ca
Status: Image is up to date for paketobuildpacks/run-jammy-full:latest
===> ANALYZING
Restoring data for SBOM from previous image
===> DETECTING
target distro name/version labels not found, reading /etc/os-release file
5 of 9 buildpacks participating
paketo-buildpacks/ca-certificates 3.8.4
paketo-buildpacks/go-dist 2.5.8
paketo-buildpacks/go-mod-vendor 1.0.35
paketo-buildpacks/go-build 2.2.7
paketo-buildpacks/procfile 5.9.1
===> RESTORING
Restoring metadata for "paketo-buildpacks/ca-certificates:helper" from app image
Restoring metadata for "paketo-buildpacks/go-dist:go" from cache
Restoring metadata for "paketo-buildpacks/go-mod-vendor:mod-cache" from cache
Restoring metadata for "paketo-buildpacks/go-build:targets" from app image
Restoring metadata for "paketo-buildpacks/go-build:gocache" from cache
Restoring data for "paketo-buildpacks/go-dist:go" from cache
Restoring data for "paketo-buildpacks/go-mod-vendor:mod-cache" from cache
Restoring data for "paketo-buildpacks/go-build:gocache" from cache
Restoring data for SBOM from cache
===> BUILDING
target distro name/version labels not found, reading /etc/os-release file
Paketo Buildpack for CA Certificates 3.8.4
https://github.com/paketo-buildpacks/ca-certificates
Build Configuration:
$BP_EMBED_CERTS false Embed certificates into the image
$BP_ENABLE_RUNTIME_CERT_BINDING true Deprecated: Enable/disable certificate helper layer to add certs at runtime
$BP_RUNTIME_CERT_BINDING_DISABLED false Disable certificate helper layer to add certs at runtime
Launch Helper: Reusing cached layer
Paketo Buildpack for Go Distribution 2.5.8
Resolving Go version
Candidate version sources (in priority order):
go.mod -> ">= 1.15"
<unknown> -> ""
Selected Go version (using go.mod): 1.22.5
Reusing cached layer /layers/paketo-buildpacks_go-dist/go
Paketo Buildpack for Go Mod Vendor 1.0.35
Executing build process
Running 'go mod vendor'
Completed in 49ms
Generating SBOM for /workspace/go.mod
Completed in 3ms
Paketo Buildpack for Go Build 2.2.7
Executing build process
Running 'go build -o /layers/paketo-buildpacks_go-build/targets/bin -buildmode pie -trimpath .'
Completed in 319ms
Generating SBOM for /layers/paketo-buildpacks_go-build/targets/bin
Completed in 2ms
Assigning launch processes:
mod (default): /layers/paketo-buildpacks_go-build/targets/bin/mod
Paketo Buildpack for Procfile 5.9.1
https://github.com/paketo-buildpacks/procfile
Process types:
web: /cnb/process/mod
===> EXPORTING
Reusing layer 'paketo-buildpacks/ca-certificates:helper'
Reusing layer 'paketo-buildpacks/go-build:targets'
Reusing layer 'buildpacksio/lifecycle:launch.sbom'
Reusing 1/1 app layer(s)
Reusing layer 'buildpacksio/lifecycle:launcher'
Adding layer 'buildpacksio/lifecycle:config'
Adding layer 'buildpacksio/lifecycle:process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Setting default process type 'web'
Saving mod-sample...
*** Images (d5fd8a092e83):
mod-sample
Reusing cache layer 'paketo-buildpacks/go-dist:go'
Adding cache layer 'paketo-buildpacks/go-dist:go'
Reusing cache layer 'paketo-buildpacks/go-mod-vendor:mod-cache'
Adding cache layer 'paketo-buildpacks/go-mod-vendor:mod-cache'
Adding cache layer 'paketo-buildpacks/go-build:gocache'
Reusing cache layer 'buildpacksio/lifecycle:cache.sbom'
Adding cache layer 'buildpacksio/lifecycle:cache.sbom'
Successfully built image mod-sample
$ docker run --interactive --tty --env PORT=8080 --publish 8080:8080 mod-sample
ERROR: failed to get platform API version; please set 'CNB_PLATFORM_API' to specify the desired platform API version
It seems there is something wrong. I had a similar error with .NET Core Buidpack and Procfile.
Expected Behavior
It should just work.
Current Behavior
ERROR: failed to get platform API version; please set 'CNB_PLATFORM_API' to specify the desired platform API version
Hmm, interesting. If you run it without Procfile Buildpack, the command that docker run is: /cnb/process/mod
I set the same command in a Procfile and got this error: ERROR: failed to get platform API version; please set 'CNB_PLATFORM_API' to specify the desired platform API version
When I changed Procfile content to: web: /layers/paketo-buildpacks_go-build/targets/bin/mod, it worked.
You would not want to do this. If there is an entry under /cnd/process/* that already exists, you don't need to also add a Procfile entry. Your entries in Procfile would point to commands that you want it to run to start your app like web: python app.py or web: node index.js or whatever is used to start your app.
In turn, the Procfile buildpack will create corresponding entries for those processes under /cnb/process/*, so if you set a web: python app.py, then you'll end up with /cnb/process/web which will execute python app.py when run.
In your case, the Go buildpack is creating /cnb/process/mod, so you just don't need the Procfile`, unless you have some other command you want to run.
Hope that helps! Let me know if you have any more questions.
It seems there is something wrong. I had a similar error with
.NET Core
Buidpack and Procfile.Expected Behavior
It should just work.
Current Behavior
ERROR: failed to get platform API version; please set 'CNB_PLATFORM_API' to specify the desired platform API version
Possible Solution
N/A
Steps to Reproduce
Motivations
I am working on a new project written in Go that has to use Paketo buildpacks (as a requirement) and be compatible with Heroku's Procfile. That's it.
The text was updated successfully, but these errors were encountered: