This package is continuation of the project of laravel development and testing project https://github.com/MaximMonin/laravel-docker It uses this same enviroment, but has project's autobuild and autotesting capabilities with gitlab-runner.
Project was build with a goal to auto create stage enviroment, test and rebuild stage server on every commit to any development repositories. Also create production builds if testing is successful.
- Clone this project
- Copy env-docker file to .env and change default values to your site
- Register new project on gitlab.
- Start containers.
Docker compose works with combination of nginx-proxy https://github.com/MaximMonin/nginx-ssh-proxy-docker, or as local installation To create nginx-proxy network run sudo docker network create nginx-proxy
-
/mail catalog consists ssmtp mail configuration files.
-
Register your project on gitlab or setup your own private gitlab server.
https://github.com/MaximMonin/gitlab-docker as example -
Register your own gitlab-runner. Run 'gitlab-runner register' inside laravel-stage container. runner/conf/config.toml file will be changed. Check in 'Run untagged jobs' in runner properties to allow gitlab see available runner.
-
Change .gitlab-ci.yml file to setup CI/CD jobs. By default this file runs scripts in runner/scripts directory and runs laravel phpunit tests and Laravel Dusk tests.
beforebuild.sh script loads projects files from development git repo and saves files in /git directory.
Change it to your laravel development project.
build.sh copies project's files to /app directory + copy .env file to setup laravel enviroment.
After copy build.sh creates/updates mysql database and then compile java scripts with webpack.
On deploy stage it extracts laravel application from container and creates production build.tar.gz
-
Register pipeline trigger for your gitlab project and follow instruction to create webhooks from source development projects.
It allows for every push to development git repos start whole CI/CD process and rebuild stage image and run tests
https://gitlab.com/api/v4/projects/projectid/ref/master/trigger/pipeline?token=copiedtoken -
Change /runner/scripts/ build-name build-version to your project name and version.
Edit files to exclude from build.tar.gz in /runner/scripts/build-exclude file.
By default port 2390 used for local site testing and 2391 for mysql administration. (root/root)
Create Production image and enviroment with https://github.com/MaximMonin/laravel-prod project