This repository allows the creation of a Docker environment to work locally, based on Apache
web
: PHP 7.3 version with Apache.mysql
: percona:5.7 image.redis
: redis:latest image.maildev
: djfarrelly/maildev:latest image.
- HTTPS : assumes the support of https locally. Please check the tips section to know how to use it
The web
container has a mount point used to share source files.
By default, the ~/www/
directory is mounted from the host. It's possible to change this path by editing the docker-compose.yml
file.
And the ./web/x-custom.ini
file is used to customize the PHP configuration during the image build process.
The ./mysql/custom.cnf
file is used to customize the MySQL configuration during the image build process.
This process assumes that Docker Engine and Docker Compose are installed. Otherwise, you should have a look to Install Docker Engine before proceeding further.
make
linux package.
$ git clone git@github.com:mattcontet/environment.git environment
It's also possible to download it as a ZIP archive.
$ make setup
$ make env
$ make aliases
$ make cron
Let's see in the tips section all what you can do
$ make install
$ docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------------------------
environment_maildev_1 bin/maildev --web 80 --smtp 25 Up 25/tcp, 0.0.0.0:1080->80/tcp
environment_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
environment_redis_1 docker-entrypoint.sh redis ... Up 0.0.0.0:6379->6379/tcp
environment_web_1 docker-custom-entrypoint Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
Note: You will see something slightly different if you do not clone the repository in a environment
directory.
The container prefix depends on your directory name.
- Getting started : Launch the command below and see all what you can do :
$ make help
-
General informations :
- To plug your database to your application (if you didn't change the information in
docker-env
file) :- host :
'mysql'
- database :
yourdatabasename
- user :
'root'
- pass :
null
- host :
- To plug your database to your application (if you didn't change the information in
-
You can add custom virtual hosts: all
./web/vhosts/*.conf
files are copied in the Apache directory during the image build process. -
The HTTPS can be used easily. Check
./web/vhosts/environment.conf
as a model to get it on all your websites. You don't need to change the cert and key files. -
Aliases :
- Symfony :
sfbin
alias forphp bin/console
sf-clear-cache
:>2.8
clear cache for all environmentssf-schema-dump
: dump the SQL needed to update the database schema to match the current mapping metadata.sf-schema-force
: execute the SQL needed to update the database schema to match the current mapping metadata.sf-assets
: install bundles web assets under a public web directory in symlinksf-fixtures
: launch the doctrine fixtures
- Others :
ll
: list the folder in a nice view
- Symfony :
-
PHP CS Fixer :
- Use it via the shell :
- You have a script in
Tools/PHP_CS_Fixer/script_php_cs.sh
- It can take as argument any relative or full path in the volume of the web container.
- You have a script in
- Use it with PHPStorm :
- There also is a tools file in
Tools/PHP_CS_Fixer/PHP_CS_Fixer.xml
. - It can be added as an external tool which allow you to use it on any files of a project.
- Just place the file in the folder :
- For Unix :
~/.<PRODUCT><VERSION>/tools
- For Windows :
<SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.<PRODUCT><VERSION>\tools
- For Mac :
~/Library/Preferences/<PRODUCT><VERSION>/tools
- For Unix :
- Change the path to the script.
- There also is a tools file in
- Use it via the shell :