Skip to content
/ docker-amp-symfony Public template

An ideal dockerized environment for Symfony, MySQL and PHP.

License

Notifications You must be signed in to change notification settings

d9beuD/docker-amp-symfony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker AMP Symfony

The purpose of this template project is to provide a quick and easy way to get a Symfony project up and running with Docker. Ths project uses Apache, MySQL and PHP.

Requirements

Usage

The first thing to do is to change a little bit the compose.yml file. You can change the MYSQL_ROOT_PASSWORD and MYSQL_DATABASE environment variables to whatever you want. You really should change the name of the container to something more meaningful.

# compose.yml
- name: project-name
+ name: name-of-your-project

Then, you can run the following command to build the containers:

make build # or `docker-compose build` if you don't have `make`

An image with PHP, Apache, Composer and Symfony CLI ready to use will be built.

After that, you can run the following command to start the containers:

make up # or `docker-compose up -d` if you don't have `make`

Apache should be ready to serve, but you don't have a Symfony project yet. You can create one by entering the Apache container and running the following command:

make exec # or `docker-compose exec apache bash` if you don't have `make`
          # it will open a bash session inside the container

Then, you can create a new Symfony project in the root directory by running the init-symfony.sh script:

./init-symfony.sh

You can now access your Symfony project at http://localhost:8080.

Remember that every time you want to run a Symfony command, you should run it inside the container thanks to the make exec command.