urbantrout / craftcms

Craft CMS Docker Image
MIT License
76 stars 32 forks source link

Dependency added by craft get uninstalled after restart #12

Closed EternalBlack closed 4 years ago

EternalBlack commented 4 years ago

I'm aware that dependencies should be added to the corresponding section inside docker-compose.yml file but am wondering about the "usability" here.

Usually I install plugins from the plugin-store of craft. As those are added to the composer.json and composer.lock file it's kind of complicated to handle this i.e. also adding those to the dependencies section of the docker-compose.yml. It feels kind of redundant. Especially as a restart is uninstalling all of those dependencies and reinstalling them. Or am I missing something?

Beside that I was also wondering if there is a special reason why not the whole craft folder is exposed via a volume? Currently I altered the volume to - ./craft:/var/www/html and this seems to work fine and gives me access to all files in an easy way.

urbantrout commented 4 years ago

The concept is that you don't install plugins via the Plugin Store but via docker-compose.yml. This way everyone on your team gets the same plugins installed when they start their containers, since you can add the docker-compose.yml to your SCM.

The script which is responsible for installing plugins on startup also removes plugins which are not listed in the env variable. This way you can uninstall unused plugins via docker-compose.yml.

About the volumes: The reason why I only mount certain directories is because I don't need all of Craft's core files and other dependencies while developing. This way I get a clean project folder with only necessary files and folders. But of course you can mount /var/www/html to your local folder.

Ryan Irelan tells you more about this setup at: https://craftquest.io/courses/localhosting-craft-cms/4981