Skip to content

ImprontaAdvance/docker-compose-symfony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-compose for Symfony env

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)

Requirements

  • Docker >=17.04
  • docker-compose >= 1.8.0

Installation

New project

  1. curl -L https://goo.gl/b5vtmq | bash -s TARGET_DIR

    where TARGET_DIR is your new project directory.

  2. Check .env file for your needs

  3. docker-compose up

  4. Open localhost:8080

A new symfony app will be installed in app directory.

Existing Project

  1. Clone this repo
  2. Put your symfony app contents in app directory
  3. Check .env file for your needs
  4. docker-compose up
  5. Open localhost:8080

Setup

Check .env file to customize server conf.

.env parameters

  • DCSF_TIMEZONE=Europe/Rome set server timezone
  • DCSF_PHP_DISPLAY_ERROR=On enable/disable errors
  • DCSF_MYSQL=1 installs pdo pdo_mysql extensions
  • DCSF_XDEBUG=1 installs xdebug with default_enable=1
  • DCSF_XDEBUG_HOST see XDebug on Mac
  • DCSF_GD=1 installs gd 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

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

XDebug on Mac

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

MIT License

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.

About

docker-compose configuration for Symfony dev environment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages