I've been looking into running Craft CMS with Docker in production. One of the most helpful and comprehensive resources I've found so far is Matt Gray's blog series. While it goes into great depth, I'm still left with some questions.
- How to handle
license.keywhen building a Docker image for production? It seems insecure to just check this into version control.
- How to manage the installation of plugins? I currently add plugins to
composer.json, the contents of which are installed when the Docker image is built. I then use the Craft CLI to install the plugin inside the container (while all services —database, nginx, php — are running) which updates my
project.yamlconfig file (available in host folder, mounted into container), which in turn I can check into version control. That way, when I build a Docker image and run it, Craft can use this
project.yamlfile. This is convoluted and painful at best; is there a better way?
- How to manage entry types, field groups, etc? Currently I manage this in much the same way as I handle the installation of plugins. This means that in production, one can never create new entry types, as they would be overwritten once a new Docker image is built and put in production.
In all, this doesn't feel robust and seems very error-prone. Does anyone have a Docker + Craft CMS workflow that's more robust that what I described above that they're willing to share?