Cut over to Rails Dockerfile Generator on Sunday 29 Jan 2023

Sometime on Sunday, a new version of flyctl will be released where the current scanner and dockerfile templates will be replaced with installing and running the dockerfile generator from the rails-dockerfile gem that is being proposed for Rails 7.1.

In a nutshell, instead of Fly providing dockerfiles for Rails applications, for Rails 7.1 and subsequent versions it will use the Dockerfiles that Rails generates. For previous versions of Rails it will use the same generator that is being proposed for Rails 7.1 to generate a Dockerfile.

The port and working directory will be parsed from the Dockerfile.

There are a number of defaults that are different from Rails and the Dockerfiles that Fly currently (and soon to be previously) creates:

  • The images will be based on the official Ruby image rather than fullstaq-ruby.
  • jemalloc will not be installed
  • database:prepare will be run on every deploy rather than as a part of a release step
  • Bin stubs will not automatically set the current working directory (which may be useful for flyctl ssh console)
  • Caches will not be used to speed up package, gem, and npm installs
  • No swap will be defined.

Each of these can be enabled by re-running bin/rails generate dockerfile with the relevant option. Options selected will be remembered and become the defaults for subsequent runs making it easier to upgrade your Dockerfile as your application changes.

In general, the Dockerfiles produced will be smaller and simpler, and the images produced will be smaller and load faster.

Should you have problems, feel free to open an issue or post here on community.fly.io.

3 Likes

Beginnings of a FAQ: Dockerfiles and fly.toml · Fly Docs

Avilable now as a pre-release:

curl -L https://fly.io/install.sh | sh -s pre

And now live with fly v0.0.451