https://github.com/sankam-nikolya/yii2-docker-template
Basic template of docker-compose.yml for Yii2 advanced
https://github.com/sankam-nikolya/yii2-docker-template
docker docker-compose yii2
Last synced: 5 months ago
JSON representation
Basic template of docker-compose.yml for Yii2 advanced
- Host: GitHub
- URL: https://github.com/sankam-nikolya/yii2-docker-template
- Owner: sankam-nikolya
- Created: 2024-02-16T17:03:18.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-11T21:14:11.000Z (about 2 years ago)
- Last Synced: 2025-04-14T06:35:58.506Z (about 1 year ago)
- Topics: docker, docker-compose, yii2
- Language: Dockerfile
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Yii2 Docker Template
Basic template of docker-compose.yml for Yii2 advanced
## How to use
1. Make the necessary changes to `env.example`, it is usually enough to change `APP_NAME`.
2. Rename `env.example` to `.env`.
3. Change the database connection configuration in the file `common/config/main-local.php` or `environments/dev/common/config/main-local.php`:
```php
...
'components' => [
'db' => [
'class' => \yii\db\Connection::class,
'dsn' => 'mysql:host=mysql;dbname=app-db',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8mb4',
],
'mailer' => [
'class' => \yii\symfonymailer\Mailer::class,
'viewPath' => '@common/mail',
'useFileTransport' => false,
'transport' => [
'dsn' => 'smtp://mailcatcher:1025',
],
],
...
```
4. Run docker compose:
```bash
docker compose -f docker-compose.yml -p {APP_NAME} -d
```
5. Available domains
- http://{APP_NAME}.localhost - frontend
- http://admin.{APP_NAME}.localhost - backend
- http://pma.{APP_NAME}.localhost - phpMyAdmin
- http://mail.{APP_NAME}.localhost - MailCatcher