Using Docker to build your development and production environments can help you reduce the burden of environment setup, regardless of which driver you use. You need to pre-install or enable some special extensions. At the same time, the environment built with Docker can help you use the Workerman and OpenSwoole drivers under the Windows environment.
You can pull the Docker configuration we recommend from the CodeIgniter4-Burner-Docker repository.
All recommended configurations are based on the webdevops/Dockerfile image, which includes common PHP extensions. You can adjust more details through this document to make your environment more suitable for your project.
At the same time, the Dockerfile environment installation instructions of OpenSwoole refer to the official Dockerfile of OpenSwoole. The Dockerfile of Workerman additionally installed php-event extension, which will make Workerman get better performance.
Note
You can install anything you need in the Dockerfile according to your project requirements. You just need to remember that they are all based on the alpine Linux image.
docker-compose build
to build your local environmentdocker-compose up -d
to run the container in the backgrounddocker-compose exec app bash
to enter the containerdocker-compose down
or docker-compose stop
can stop your containerdocker-compose.yml
is 8080:8080
, you can adjust this setting according to your own needs.Note
If your CodeIgniter4 does not contain the vendor folder, remember to use composer install
to pull the libraries required by the project.
Powered by Doctave