Last active
December 17, 2017 23:04
-
-
Save RyosukeKamei/27cab7ec9a73a6085d614b7ab900581a to your computer and use it in GitHub Desktop.
超簡単!Laradockを利用してLaravel開発環境を構築~アジャイルでDevOpsなシステム構築実践~ ref: https://qiita.com/RyosukeKamei/items/085b40e4e869e77b0756
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 略 | |
'connections' => [ | |
'sqlite' => [ | |
'driver' => 'sqlite', | |
'database' => env('DB_DATABASE', database_path('database.sqlite')), | |
'prefix' => '', | |
], | |
'mysql' => [ | |
'driver' => 'mysql', | |
'host' => env('DB_HOST', 'mysql'), | |
'port' => env('DB_PORT', '3306'), | |
'database' => env('DB_DATABASE', '{.envで設定したデータベース名 例:colejo}'), | |
'username' => env('DB_USERNAME', '{.envで設定したユーザ名 例:colejo}'), | |
'password' => env('DB_PASSWORD', '{.envで設定したパスワード 例:colejo_pass}'), | |
'unix_socket' => env('DB_SOCKET', ''), | |
'charset' => 'utf8mb4', | |
'collation' => 'utf8mb4_unicode_ci', | |
'prefix' => '', | |
'strict' => true, | |
'engine' => null, | |
], | |
// 略 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo/laradock (master) | |
$ docker-compose exec workspace composer create-project --prefer-dist laravel/laravel ./ | |
Do not run Composer as root/super user! See https://getcomposer.org/root for details | |
Installing laravel/laravel (v5.5.22) | |
- Installing laravel/laravel (v5.5.22): Downloading (100%) | |
Created project in ./ | |
> @php -r "file_exists('.env') || copy('.env.example', '.env');" | |
... 略 ... | |
> @php artisan key:generate | |
Application key [base64:{キー}] set successfully. | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo/laradock (master) | |
$ cp env-example .env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo | |
$ git init | |
Initialized empty Git repository in C:/Users/{ユーザ名}/colejo/.git/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo (master) | |
$ cd laradock/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### MYSQL ############################################################################################################## | |
MYSQL_VERSION=8.0 | |
MYSQL_DATABASE={任意のデータベース名 例:colejo} | |
MYSQL_USER={任意のユーザ名 例:colejo} | |
MYSQL_PASSWORD={任意のパスワード 例:colejo_pass} | |
MYSQL_PORT=3306 | |
MYSQL_ROOT_PASSWORD={任意のrootパスワード 例:colejo_root_pass} | |
MYSQL_ENTRYPOINT_INITDB=./mysql/docker-entrypoint-initdb.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Application Path ################################################################################################### | |
# Point to your code, will be available at `/var/www`. | |
APPLICATION=../src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo (master) | |
$ git submodule add https://github.com/Laradock/laradock.git | |
Cloning into 'C:/Users/{ユーザ名}/colejo/laradock'... | |
remote: Counting objects: 6289, done. | |
remote: Compressing objects: 100% (40/40), done. | |
remote: Total 6289 (delta 18), reused 29 (delta 7), pack-reused 6241 | |
Receiving objects: 100% (6289/6289), 6.01 MiB | 393.00 KiB/s, done. | |
Resolving deltas: 100% (3298/3298), done. | |
Checking connectivity... done. | |
warning: LF will be replaced by CRLF in .gitmodules. | |
The file will have its original line endings in your working directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo (master) | |
$ ls | |
laradock/ src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo (master) | |
$ mkdir src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo/laradock (master) | |
$ docker-compose up -d nginx mysql | |
... インストール たくさんメッセージ ... | |
Recreating laradock_applications_1 ... | |
Recreating laradock_mysql_1 ... | |
Recreating laradock_applications_1 | |
Recreating laradock_applications_1 ... done | |
Recreating laradock_workspace_1 ... | |
Recreating laradock_workspace_1 ... done | |
Recreating laradock_php-fpm_1 ... | |
Recreating laradock_php-fpm_1 ... done | |
Recreating laradock_nginx_1 ... | |
Recreating laradock_nginx_1 ... done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB_CONNECTION=mysql | |
DB_HOST=mysql | |
DB_PORT=3306 | |
DB_DATABASE={.envで設定したデータベース名 例:colejo} | |
DB_USERNAME={.envで設定したユーザ名 例:colejo} | |
DB_PASSWORD={.envで設定したパスワード 例:colejo_pass} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/colejo/laradock (master) | |
$ docker ps | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
530b4296be85 laradock_nginx "nginx" 56 seconds ago Up 55 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp laradock_nginx_1 | |
80b9ab70dc63 laradock_php-fpm "docker-php-entryp..." 57 seconds ago Up 56 seconds 9000/tcp laradock_php-fpm_1 | |
6630e9bd63f6 laradock_workspace "/sbin/my_init" 57 seconds ago Up 56 seconds 0.0.0.0:2222->22/tcp laradock_workspace_1 | |
949ab9ef9495 laradock_mysql "docker-entrypoint..." 58 seconds ago Up 57 seconds 0.0.0.0:3306->3306/tcp laradock_mysql_1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-compose exec workspace php artisan migrate | |
Migration table created successfully. | |
Migrating: 2014_10_12_000000_create_users_table | |
Migrated: 2014_10_12_000000_create_users_table | |
Migrating: 2014_10_12_100000_create_password_resets_table | |
Migrated: 2014_10_12_100000_create_password_resets_table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@xxx ~/ | |
$ mkdir colejo | |
$ cd colejo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment