This is a dockerized basic project structure for PHP development.
Things you should know
Your code should go into ./src
Web server
- Exposed ports (host:container): 80:80
- Web server: apache
- PHP version: 7
- Installed extensions: PDO (MYSQL,SQLITE)
Database
- DB: MYSQL
- DB hostname(what to put in your code): 'db'
- DB environment is defined in ./db/env
How to import a database dump on startup?
Just put your file at ./db/schema.sql
How to import a .sql later on, after the startup?
cd db
bash import.sh mydump.sqlHow to use this?
# Clone repo git clone https://github.com/IOAyman/docker-phpdev.git myawesomeproject cd myawesomeproject # Do the house cleaning python clean.py -h usage: clean.py [-h] [-git] [-db dbname root_password user user_password] Clean and re-initialize your project folder optional arguments: -h, --help show this help message and exit -git Re-initialize a git repository -db dbname root_password user user_password Change the default database creadentials # Run the containers docker-compose -d up # Test curl localhost # Shutdown the containers docker-compose down