ALCales / docker-symfony-php-nginx-mysql

Create new Symfony project from PHP container with Symfony CLI. | Docker + PHP 8.1 + Xdebug 3 + MySQL 8 + Nginx 1.21 + Symfony CLI 🐳
5 stars 1 forks source link
docker mysql nginx php symfony xdebug

Docker + PHP 8.1 + Xdebug 3 + MySQL 8 + Nginx 1.21 + Symfony Boilerplate 🐳

Description

This is a basic stack for create y running Symfony project into Docker containers. Here are the docker-compose built images:

Installation

Docker containers

  1. Clone this repository

  2. Go inside folder ./docker

  3. Edit environment variables in .env file

    1. The value of the variable NGINX_SERVER_NAME is the server_name used in NGINX.
  4. Build/run containers.

    docker-compose build
    docker compose up -d

    Symfony project

  5. You should work inside the php container.

    docker compose exec php bash
  6. Check requirements for a Symfony application

    symfony check:requirements

    you will see the following output in the terminal

    [OK]                                             
    Your system is ready to run Symfony projects
  7. Create a new Symfony project

    symfony new .

    You Symfony project will be installed in /app folder. Now you can access it from the browser through the domain that you have specified in the NGINX_SERVER_NAME variable of the .env file.

alt text

Xdebug

Available by default. Configure /docker/php/xdebug.ini

Directory strcuture

Project (/var/www/)
β”œβ”€β”€ docker
β”‚   β”œβ”€β”€ mysql
β”‚   β”œβ”€β”€ nginx
β”‚   └── php
└── app
    └── .. all symfony content