Subscribe to PHP Freaks RSS

Installing Bolt extensions on Docker

syndicated from planet-php.net on February 23, 2018

I'm currently working on a website with the Bolt CMS. For this website, I am using an extension. Now, the "problem" with extensions is that they are installed using Composer by Bolt, and end up in the .gitignore'd vendor/ directory. Which is OK while developing, because the extension will just be in my local codebase, but once I commit my changes and push them, I run into a little problem.



Some context



Let's start with a bit of context: Our current hosting platform is a bunch of Digital Ocean droplets managed by Rancher. We use Gitlab for our Git hosting, and use Gitlab Pipelines for building our docker containers and deploying them to production.



The single line solution



In Slack, I checked with Bob to see what the easiest way was of getting the extensions installed when they're in the configuration but not in vendor/, and the solution was so simple I had not thought of it:



Run composer install --no-dev in your extensions/ directory



So I adapted my Dockerfile to include a single line:



RUN cd /var/www/extensions && composer install --no-dev


I committed the changes, pushed them, Gitlab picked them up and built the new container, Rancher pulled the new container and switched it on, and lo and behold, the extension was there!





Sometimes the simple solutions are actually the best solutions