I currently run unit tests for some projects using a PHP docker image. This works fine, with code self contained within the project.
services: - mysql:5.6 - memcached:alpine before_script: - composer install --no-progress --no-interaction - npm install - npm run dev - php artisan key:generate - php artisan migrate - php artisan db:seed php7.1: image: giggsey/docker-php7:7.1-latest script: - vendor/bin/phpunit --coverage-text --colors=never --coverage-clover coverage.xml
However, I’m trying to move away from having each project seed it’s own data, and instead have a separate docker image that automatically seeds all the data.
Is there a way of running this other docker container in the before_script section of the above test, having it using the existing services?
I managed to get something similar working in another project by mixing docker-compose, and running GitLab CI using the docker and dind services. However, this introduces a fair bit of complexity into the project that I’d like to avoid.
I’m happy to add additional packages etc. to my docker-php images (they’re already huge, and only used by me) if this would get it working.