We’ve just added a new feature to flyctl which lets you build and deploy NodeJS, Rails, Go, and Java applications to the Fly platform with just two commands. That new feature is support for Cloud Native Buildpacks, but you don’t need to know what Buildpacks are to use them with Fly.
A Speedrun for everyone
Let’s get straight down to it. Make sure you have the latest version of flyctl and then get a Node application like this version of our hello world example - “hellonode-builder”.
git clone https://github.com/fly-apps/hellonode-builtin.git
Now let’s create a fly application for it with one line:
cd hellonode-build
flyctl init --builder cloudfoundry/cnb:bionic
Hit return for an autogenerated name and flyctl will set up a fly app for you. Make a note of that name. Then all you need to do is:
flyctl deploy
And the application will be turned into a docker image and deployed onto the Fly Global Application Platform. Connect to your newly deployed app by running flyctl open
and you’re already Flying.
Flyctl and Buildpacks
What we have added is the ability for flyctl
to use Cloud Native Buildpacks from the buildpacks.io project. This new Buildpack system is an evolution of existing Buildpack systems from Heroku and Cloud Foundry, designed to be used by different platforms.
The new Cloud Native Buildpack system isn’t compatible with the older Heroku and Cloud Foundry buildpacks, but new Cloud Native Buildpacks are appearing every day to supercede them. As the availability expands, even more languages and frameworks will be able to be automatically built and deployed by flyctl.
The new Buildpack support complements our existing support of Dockerfiles for building your Fly deployment images. You can use that when there’s no appropriate buildpack available or you want to do something different from existing buildpacks. We’re making sure you have all the flexibility and power you need to hand.
Available Cloud Native Builders
There are already Cloud Native Buildpacks that support building Rails, NodeJS, Go and Java applications with Ubuntu, Alpine or distroless stacks. Here are some of the stacks we’ve already tested:
Builder Name | ImageSize | Languages/Frameworks |
cloudfoundry/cnb:bionic | Small | Java,Node.js |
cloudfoundry/cnb:cflinuxfs3 | Large | Java, Node.js, Python |
cloudfoundry/cnb:tiny | Tiny | Go |
heroku/buildpacks:18 | Large | Ruby, Java, Node.js, Python, Golang, PHP |
If you are unsure which to use, we recommend the “heroku/buildpacks:18” option for its wide coverage.