|
| 1 | +Docker-compose config for Yii 2 Advanced Project Template |
| 2 | +=================================== |
| 3 | +Yii 2 docker is a configuration for easy deployment and development of Yii 2 Advanced Project Template. |
| 4 | + |
| 5 | +REQUIREMENTS |
| 6 | +------------ |
| 7 | + |
| 8 | +Docker and Docker compose |
| 9 | + |
| 10 | +INSTALLATION VIA COMPOSER |
| 11 | +------------------------- |
| 12 | +``` |
| 13 | +composer create-project --prefer-dist --no-install consultnn/yii2-docker-app-advanced app |
| 14 | +``` |
| 15 | + |
| 16 | +MANUALLY INSTALLATION |
| 17 | +--------------------- |
| 18 | +Clone this repository |
| 19 | +``` |
| 20 | +git clone https://github.com/consultnn/yii2-docker-app-advanced.git app |
| 21 | +``` |
| 22 | +Change directory |
| 23 | +``` |
| 24 | +cd app |
| 25 | +``` |
| 26 | +Remove git directory |
| 27 | +``` |
| 28 | +rm -rf .git |
| 29 | +``` |
| 30 | +Install Yii 2 Advanced Project Template via composer inside docker container |
| 31 | +``` |
| 32 | +docker-compose run --rm php composer create-project --prefer-dist yiisoft/yii2-app-advanced project |
| 33 | +``` |
| 34 | +Change project directory owner (default root, because process inside container run as root) |
| 35 | +``` |
| 36 | +chown -R $USER:$USER project |
| 37 | +``` |
| 38 | + |
| 39 | +DIRECTORY STRUCTURE |
| 40 | +------------------- |
| 41 | +``` |
| 42 | +docker contains docker configuration, build files and logs |
| 43 | + nginx nginx docker configuration |
| 44 | + php php docker configuration |
| 45 | +project Yii 2 Advanced Project Template |
| 46 | +docker-compose.yml docker-compose configuration |
| 47 | +``` |
| 48 | + |
| 49 | + |
| 50 | +USING |
| 51 | +------ |
| 52 | +For executing commands inside docker container run |
| 53 | +~~~ |
| 54 | +docker-compose run --rm {service} {command} |
| 55 | +or, if application already running |
| 56 | +docker exec {service} {command} |
| 57 | +~~~ |
| 58 | +For example: |
| 59 | +~~~ |
| 60 | +docker-compose run php composer install |
| 61 | +docker exec run php /init |
| 62 | +~~~ |
| 63 | + |
| 64 | +Start docker containers |
| 65 | +~~~ |
| 66 | +docker-compose up -d |
| 67 | +~~~ |
| 68 | +NOTE: for composer use `--prefer-dist` options, git not installed in php container. |
| 69 | +NOTE: inside php container default directory - project |
| 70 | + |
| 71 | +After start check http://127.0.0.1:8090 |
0 commit comments