Local Docker environemnt: PHP + MYSQL + Mongo + Redis
A local dockerized environment running:
- PHP 7.4
- MySQL 5.7
- MongoDB 4.2
- Redis 4.0
(Setup instructions for Mac users)
Require
Install Docker
Setup
Step 1 - clone environment
Clone the envormaent into a folder of your choice {MY_ENV}:
git clone https://github.com/pdphilip/docker-LAMP-MR.git MY_ENV
Step 2 - set up hosts
For example:
- www.domain.loc
- api.domain.loc
Step 2.1 - edit sites-enabled
in env/php/sites-enabled/
- www.domain.loc.conf
- api.domain.loc.conf
Edit domain_name variable on first line:
Define domain_name www.domain.loc
Define domain_name api.domain.loc
Step 2.2 - edit Mac host file
Via Terminal:
sudo nano /etc/hosts
Then add in:
0.0.0.0 localhost
0.0.0.0 www.domain.loc
0.0.0.0 api.domain.loc
Step 3 - docker-compose build
In repo root, run:
docker-compose build
Running:
In repo root, run:
docker-compose up
Notes:
- Local site files root in ./sites/{domain}/html
- Add ENV vars under the PHP container in docker-compose.yml
- Data is persisted locally in: ./data/{engine}/
Simples
Local only please, nothing is secure