/yii2-docker-template

Basic template of docker-compose.yml for Yii2 advanced

Primary LanguageDockerfile

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:

    ...
    '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',
            ],
        ],
        ...
  1. Run docker compose:
docker compose -f docker-compose.yml -p {APP_NAME} -d
  1. Available domains