Production Docker custom modules installation options

TL;DR What options would you prefer for installing custom modules into a production docker

I’ve been playing around with the lightsail docker installation looking to put up a production instance for an individual and I ran into the situation where I want to install a custom module as part of the setup.

The way things are right now, it looks like I have a couple of complex routes of getting the module into the production docker image.

  • I can apply the module like a patch using wget and unzip similar to what is done with a patch
    ** Pros nothing needs to change infrastructure wise
    ** Cons - module install needs to be re-applied everytime the docker is updated / upgraded to a newer docker version. Any backup / restore operation will have to follow the same process.
  • Build a new docker image containing the module on top of the OpenEMR docker image
    ** Pros - module is retained on backup / restore operations
    ** Cons - Have to rebuild the container anytime the OpenEMR container updates
  • Use a shared volume for the custom modules
    ** Pros - code is retained through docker updates, backup / restore, etc
    ** Cons - if any core module is updated / rebuilt from the core Docker images, there needs to be a syncing mechanism to get these changes in place. Clustered dockers (such as Kubernetes) are less performant when having to hit a shared drive for code files.

There’s likely other options, but I wanted to throw these out there and get people’s thoughts on handling the module integration when working with production docker images. Perhaps someone has a solution they use already in place they would like to chime in on.