How to override node version

Hi,

It sounds like you would have used the default builder, where Fly takes a look at your app and picks how to deploy it. In which case to make your own changes to customise your image/build, I think you’d probably have to use the other way to build an image of your app for Fly to deploy: using a Dockerfile.

Basically a Dockerfile is a text file that tells Fly what to do. You can tell it what node version to install, what folders to add, and how your app should run. Doing that would certainly let you choose node 16.

For example take a look at this sample node app:

You will see within that is a Dockerfile. First line: I install node 18. You would simply edit that to be 16 :slight_smile: Done!

In my Dockerfile I then go on to make a folder, install the dependencies, copy the code into it, and run the app. It is a hello world so your app may need more, but that’s basically it:

And note that you should add a sibling .dockerignore file too. That tells the Dockerfile what to (yep) ignore. As you’ll want it to ignore e.g your .env file. And anything else you don’t want copied into your image.

1 Like