If you have ever had to setup Travis-CI, I’m sure you know where the biggest pain point is - debugging the machine.
We have lost so many hours on intermediate commits, waiting for Travis to spin up a new box, run the scripts only to see it fail on the last command. Not to mention how hard it is to debug a webapp on a machine you don’t have direct access to, and there is no browser.
But there’s a new and better way - we can use Docker inside Travis.
What does that mean? In short, it means that setting up Travis, and debugging your test scripts has just become much easier. You can do all the setup, and the debugging from your own local computer!
In fact, even our
.travis.yml has been reduced to just a few lines -
docker build or
docker pull an existing image, and then just
docker run it, as all the setup and tests are now controlled by your docker scripts:
sudo: false language: php services: - docker # Replace with your image name. before_script: - docker pull gizra/drupal-lamp script: - docker run -it -p 8080:80 gizra/drupal-lamp
Why am I even asking? Of course you want it! So I’ve created a base image for all the Drupal devs to use (or fork) and it’s on docker hub (and on GitHub). The base image will give you Drupal, Apache2, MySQL, Git, Composer, Drush, etc.
Next time you need to setup Travis, don’t try to do it the “old” way - just remember it’s easier to debug on your own machine.