Override / customize Dockerfile structure when generating a release

Hi,

Is there a way to customize the template used (internally by mix) to generate the Dockerfile when running mix phx.gen.release --docker ?

Thank you.

The file path for the Dockerfile template is hardcoded in the phx.gen.release mix task so you’d have to fork phoenix to customize it.

You could also duplicate the phx.gen.release mix task as your own mix task and enhance it so that it can accept an optional path to your own Dockerfile/dockerignore templates. Or abstract out just the docker bits and enhance that in your own mix task.

2 Likes

You can customize generator templates per project, but that‘s not of much use for one time generated files like the dockerfile: Customizing Phoenix Generators · The Phoenix Files

1 Like