I have a Laravel application which has some Integration Tests and this project has Dockerized using Docker Compose and it's consisted of 5 containers: php-fpm
, mysql
, redis
, nginx
and the workspace
which have php-cli
and composer
installed in itself (just like Laradock). I want to run the tests while the test stage
is running in my CI process. I have to mention that my CI Server is GitLab CI.
Basically, I run the tests on my local system by running the following commands in my terminal:
$ docker-compose up -d
Creating network "docker_backend" with driver "bridge"
Creating network "docker_frontend" with driver "bridge"
Creating redis ... done
Creating workspace ... done
Creating mysql ... done
Creating php-fpm ... done
Creating nginx ... done
$ docker-compose exec workspace bash
// now, I have logged in to workspace container
$ cd /var/www/app
$ phpunit
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.
........ 8 / 8 (100%)
Time: 38.1 seconds, Memory: 28.00MB
OK (8 tests, 56 assertions)
Here is my question: How I can run these tests in test stage while there is no running container? What're the Best Practices in this case?
I also followed this documentation of GitLab, but it seems that is not OK to use Docker-in-Docker or Docker Socket Binding.