Out of the box symfony environment using docker-compose. It contains:
- PHP-FPM optimized
- nginx as web server
- MariaDB as mysql-like server
- XDebug (optional)
- GD libraries (optional)
- Docker >=17.04
- docker-compose >= 1.8.0
-
curl -L https://goo.gl/b5vtmq | bash -s TARGET_DIR
where
TARGET_DIR
is your new project directory. -
Check
.env
file for your needs -
docker-compose up
-
Open localhost:8080
A new symfony app will be installed in app
directory.
- Clone this repo
- Put your symfony app contents in
app
directory - Check
.env
file for your needs docker-compose up
- Open localhost:8080
Check .env
file to customize server conf.
DCSF_TIMEZONE=Europe/Rome
set server timezoneDCSF_PHP_DISPLAY_ERROR=On
enable/disable errorsDCSF_MYSQL=1
installspdo pdo_mysql
extensionsDCSF_XDEBUG=1
installsxdebug
withdefault_enable=1
DCSF_XDEBUG_HOST
see XDebug on MacDCSF_GD=1
installsgd
extensions (for image manipulation)
These variables are used building time. If you want to enable/disable after first run, you have to rebuild it: docker-compose build php
.
Docker for Mac has still big problems of slowness with shared volumes (Ref. docker/for-mac#77). In the docker-compose.yml
file the tool configures the volumes as cached
(Ref: docker.com/osxfs-caching/) to improve the speed of the framework.
- ./app:/var/www/app:cached
Inside docker container, the only way to communicate with xdebug is with static ip (ref. xdebug/remote#communication).
Docker for Mac uses a VM as host for docker containers. To be reached, you xdebug server must be visible from php container.
In Docker for Mac 17.06+, it works using docker.for.mac.localhost
hostname.
If you're using Docker for Mac 17.05 or below, please update. If you can't, you have to create an alias to your local IP: sudo ifconfig lo0 alias 10.254.254.254
. Then put aliased IP to .env
file:
DCSF_XDEBUG_HOST=10.254.254.254
Credits: https://gist.github.com/chadrien/c90927ec2d160ffea9c4
Copyright (c) 2017 Impronta Advance srl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.