Fix conflicts

This commit is contained in:
Luciano Gonçalves 2016-09-01 13:23:40 +01:00
commit a3039958e3
18 changed files with 1246 additions and 56 deletions

983
README-zh.md Normal file
View File

@ -0,0 +1,983 @@
# LaraDock
[![forthebadge](http://forthebadge.com/images/badges/built-by-developers.svg)](http://zalt.me)
[![Gitter](https://badges.gitter.im/LaraDock/laradock.svg)](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
LaraDock能够帮你在**Docker**上快速搭建**Laravel**应用。
<br>
就像Laravel Homestead一样但是Docker替换了Vagrant。
>先在Docker上使用LaraDock然后再学习它们。
![](https://s31.postimg.org/nbettdki3/lara_dock_poster_new.jpg)
<br>
## 目录
- [Intro](#Intro)
- [Features](#features)
- [Supported Software's](#Supported-Containers)
- [What is Docker](#what-is-docker)
- [What is Laravel](#what-is-laravel)
- [Why Docker not Vagrant](#why-docker-not-vagrant)
- [LaraDock VS Homestead](#laradock-vs-homestead)
- [Demo Video](#Demo)
- [Requirements](#Requirements)
- [Installation](#Installation)
- [Usage](#Usage)
- [Documentation](#Documentation)
- [Docker](#Docker)
- [List current running Containers](#List-current-running-Containers)
- [Close all running Containers](#Close-all-running-Containers)
- [Delete all existing Containers](#Delete-all-existing-Containers)
- [Enter a Container (SSH into a running Container)](#Enter-Container)
- [Edit default container configuration](#Edit-Container)
- [Edit a Docker Image](#Edit-a-Docker-Image)
- [Build/Re-build Containers](#Build-Re-build-Containers)
- [Add more Software's (Docker Images)](#Add-Docker-Images)
- [View the Log files](#View-the-Log-files)
- [Laravel](#Laravel):
- [Install Laravel from a Docker Container](#Install-Laravel)
- [Run Artisan Commands](#Run-Artisan-Commands)
- [Use Redis](#Use-Redis)
- [Use Mongo](#Use-Mongo)
- [PHP](#PHP)
- [Install PHP Extensions](#Install-PHP-Extensions)
- [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version)
- [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version)
- [Install xDebug](#Install-xDebug)
- [Misc](#Misc)
- [Use custom Domain](#Use-custom-Domain)
- [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install)
- [Install Prestissimo](#Install-Prestissimo)
- [Install Node + NVM](#Install-Node)
- [Debugging](#debugging)
- [Upgrading LaraDock](#upgrading-laradock)
- [Help & Questions](#Help)
<a name="Intro"></a>
## 介绍
LaraDock努力简化创建开发环境过程。
它包含预包装Docker镜像提供你一个美妙的开发环境而不需要安装PHP,NGINX,MySQL和其他任何软件在你本地机器上。
**使用概览:**
让我们了解使用它安装`NGINX`, `PHP`, `Composer`, `MySQL``Redis`,然后运行`Laravel`
1. 将LaraDock放到你的Laravel项目中
<br>
`git clone https://github.com/LaraDock/laradock.git`.
2. 进入LaraDock目录然后运行这些容器。
<br>
`docker-compose up -d nginx mysql redis`
3. 打开你的`.env`文件,然后设置`mysql`的`DB_HOST` 和 `redis`的`REDIS_HOST`。
4. 打开浏览器访问localhost
<a name="features"></a>
### 特点
- 在PHP版本7.05.6.5.5...之中可以简单切换。
- 可选择你最喜欢的数据库引擎比如MySQL, Postgres, MariaDB...
- 可运行自己的软件组合比如Memcached, HHVM, Beanstalkd...
- 所有软件运行在不同的容器之中比如PHP-FPM, NGINX, PHP-CLI...
- 通过简单的编写`dockerfile`容易定制任何容器。
- 所有镜像继承自一个官方基础镜像Trusted base Images
- 可预配置Laravel的Nginx环境
- 容易应用容器中的配置
- 干净的结构化的Docker配置文件`dockerfile`
- 最新的Docker Compose 版本(`docker-compose`
- 所有的都是可视化和可编辑的
- 快速的镜像构建
- 每周都会有更新...
<a name="Supported-Containers"></a>
### 支持的软件 (容器)
- **数据库引擎:**
- MySQL
- PostgreSQL
- MariaDB
- MongoDB
- Neo4j
- **缓存引擎:**
- Redis
- Memcached
- **PHP 服务器:**
- NGINX
- Apache2
- Caddy
- **PHP 编译工具:**
- PHP-FPM
- HHVM
- **消息队列系统:**
- Beanstalkd (+ Beanstalkd Console)
- **工具:**
- Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...)
>如果你找不到你需要的软件,构建它然后把它添加到这个列表。你的贡献是受欢迎的。
<a name="what-is-docker"></a>
### Docker是什么?
[Docker](https://www.docker.com) 是一个开源项目,自动化部署应用程序软件的容器,在Linux, Mac OS and Windows提供一个额外的抽象层和自动化的[操作系统级的虚拟化](https://en.wikipedia.org/wiki/Operating-system-level_virtualization)
<a name="what-is-laravel"></a>
### Laravel是什么?
额,这很认真的!!!
<a name="why-docker-not-vagrant"></a>
### 为什么使用Docker而不是Vagrant!?
[Vagrant](https://www.vagrantup.com)构建虚拟机需要几分钟然而Docker构建虚拟容器只需要几秒钟。
而不是提供一个完整的虚拟机,就像你用Vagrant,Docker为您提供**轻量级**虚拟容器,共享相同的内核和允许安全执行独立的进程。
除了速度,Docker提供大量的Vagrant无法实现的功能。
最重要的是Docker可以运行在开发和生产(相同环境无处不在)。Vagrant是专为开发,(所以在生产环境你必须每一次重建您的服务器)。
<a name="laradock-vs-homestead"></a>
### LaraDock Homestead 对比
LaraDock and [Homestead](https://laravel.com/docs/master/homestead) 给你一个完整的虚拟开发环境。(不需要安装和配置软件在你自己的每一个操作系统)。
Homestead 是一个工具,为你控制虚拟机(使用Homestead特殊命令)。Vagrant可以管理你的管理虚容器。
运行一个虚拟容器比运行一整个虚拟机快多了**LaraDock 比 Homestead快多了**
<a name="Demo"></a>
## 演示视频
还有什么比**演示视频**好:
- LaraDock v4.0 (即将到来的...)
- LaraDock [v2.2](https://www.youtube.com/watch?v=-DamFMczwDA)
- LaraDock [v0.3](https://www.youtube.com/watch?v=jGkyO6Is_aI)
- LaraDock [v0.1](https://www.youtube.com/watch?v=3YQsHe6oF80)
<a name="Requirements"></a>
## 依赖
- [Git](https://git-scm.com/downloads)
- [Docker](https://www.docker.com/products/docker/)
<a name="Installation"></a>
## 安装
1 - 克隆 `LaraDock` 仓库:
**A)** 如果你已经有一个Laravel项目,克隆这个仓库在到`Laravel`根目录
```bash
git submodule add https://github.com/LaraDock/laradock.git
```
>如果你不是使用Git管理Laravel项目,您可以使用 `git clone` 而不是`git submodule`。
**B)** 如果你没有一个Laravel项目,你想Docker安装Laravel,克隆这个源在您的机器任何地方上:
```bash
git clone https://github.com/LaraDock/laradock.git
```
<a name="Usage"></a>
## 使用
**请在开始之前阅读:**
如果你正在使用**Docker Toolbox** (VM),选择以下任何一个方法:
- 更新到Docker [Native](https://www.docker.com/products/docker) Mac/Windows版本 (建议). 查看 [Upgrading Laradock](#upgrading-laradock)
- 使用 LaraDock v3.* (访问 `LaraDock-ToolBox` [分支](https://github.com/LaraDock/laradock/tree/LaraDock-ToolBox)).
如果您使用的是**Docker Native**(Mac / Windows版本)甚至是Linux版本,通常可以继续阅读这个文档LaraDock v4以上版本将仅支持**Docker Native**。
<br>
<br>
1 - 运行容器: *(在运行`docker-compose`命令之前,确认你在 `laradock` 目录中*
**例子:** 运行 NGINX 和 MySQL:
```bash
docker-compose up -d nginx mysql
```
你可以从以下列表选择你自己的容器组合:
`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`.
**说明**: `workspace``php-fpm` 将运行在大部分实例中, 所有不用在命令中 `up`加上它们.
<br>
2 - 进入 Workspace 容器, 执行像 (Artisan, Composer, PHPUnit, Gulp, ...)等命令
```bash
docker-compose exec workspace bash
```
<br />
增加 `--user=laradock` (例如 `docker-compose exec --user=laradock workspace bash`) 作为您的主机的用户创建的文件. (你可以从 `docker-compose.yml`修改 PUID (User id) 和 PGID (group id) 值 ).
<br>
3 - 编辑 Laravel 的配置.
如果你还没有安装Laravel项目请查看 [How to Install Laravel in a Docker Container](#Install-Laravel).
打开 Laravel的 `.env` 文件 然后 配置 你的`mysql`的`DB_HOST`:
```env
DB_HOST=mysql
```
<br>
4 - 打开浏览器访问localhost (`http://localhost/`).
<br>
**调试**: 如果你碰到任何问题,请查看 [调试](#debugging) 章节
如果你需要特别支持,请联系我,更多细节在[帮助 & 问题](#Help)章节
<br>
<a name="Documentation"></a>
## 文档
<a name="Docker"></a>
### [Docker]
<a name="List-current-running-Containers"></a>
### 列出正在运行的容器
```bash
docker ps
```
你也可以使用以下命令查看某项目的容器
```bash
docker-compose ps
```
<br>
<a name="Close-all-running-Containers"></a>
### 关闭所有容器
```bash
docker-compose stop
```
停止某个容器:
```bash
docker-compose stop {容器名称}
```
<br>
<a name="Delete-all-existing-Containers"></a>
### 删除所有容器
```bash
docker-compose down
```
小心这个命令,因为它也会删除你的数据容器。(如果你想保留你的数据你应该在上述命令后列出容器名称删除每个容器本身):*
<br>
<a name="Enter-Container"></a>
### 进入容器 (通过SSH 进入一个运行中的容器)
1 - 首先使用 `docker ps`命令查看正在运行的容器
2 - 进入某个容器使用:
```bash
docker-compose exec {container-name} bash
```
*例如: 进入 MySQL 容器*
```bash
docker-compose exec mysql bash
```
3 - 退出容器, 键入 `exit`.
<br>
<a name="Edit-Container"></a>
### 编辑默认容器配置
打开 `docker-compose.yml` 然后 按照你想的修改.
例如:
修改 MySQL 数据库名称:
```yml
environment:
MYSQL_DATABASE: laradock
```
修改 Redis 默认端口为 1111:
```yml
ports:
- "1111:6379"
```
<br>
<a name="Edit-a-Docker-Image"></a>
### 编辑Docker镜像
1 - 找到你想修改的镜像的 `dockerfile` ,
<br>
例如: `mysql``mysql/Dockerfile`.
2 - 按你所要的编辑文件.
3 - 重新构建容器:
```bash
docker-compose build mysql
```
更多信息在容器重建中 [点击这里](#Build-Re-build-Containers).
<br>
<a name="Build-Re-build-Containers"></a>
### 建立/重建容器
如果你做任何改变`dockerfile`确保你运行这个命令,可以让所有修改更改生效:
```bash
docker-compose build
```
选择你可以指定哪个容器重建(而不是重建所有的容器):
```bash
docker-compose build {container-name}
```
如果你想重建整个容器,你可能需要使用 `--no-cache` 选项 (`docker-compose build --no-cache {container-name}`).
<br>
<a name="Add-Docker-Images"></a>
### 增加更多软件 (Docker 镜像)
为了增加镜像(软件), 编辑 `docker-compose.yml` 添加容器细节, 你需要熟悉 [docker compose 文件语法](https://docs.docker.com/compose/compose-file/).
<br>
<a name="View-the-Log-files"></a>
### 查看日志文件
Nginx的日志在 `logs/nginx` 目录
然后查看其它容器日志(MySQL, PHP-FPM,...) 你可以运行:
```bash
docker logs {container-name}
```
<br>
<a name="Laravel"></a>
### [Laravel]
<a name="Install-Laravel"></a>
### 从Docker镜像安装Laravel
1 - 首先你需要进入 Workspace 容器.
2 - 安装 Laravel.
例如 使用 Composer
```bash
composer create-project laravel/laravel my-cool-app "5.2.*"
```
> 我们建议使用 `composer create-project` 替换Laravel 安装器去安装Laravel.
关于更多Laravel安装内容请 [点击这儿](https://laravel.com/docs/master#installing-laravel).
3 - 编辑 `docker-compose.yml` 映射新的应用目录:
系统默认LaraDock假定Laravel应用在LaraDock的父级目录中
By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder.
自新Laravel应用在 `my-cool-app` 目录中, 我们需要用 `../my-cool-app/:/var/www/laravel`替换 `../:/var/www/laravel` , 如下:
```yaml
application:
build: ./application
volumes:
- ../my-cool-app/:/var/www/laravel
```
4 - 进入目录下继续工作..
```bash
cd my-cool-app
```
5 - 回到LaraDock安装步骤,看看如何编辑`env`的文件。
<br>
<a name="Run-Artisan-Commands"></a>
### 运行 Artisan 命令
你可以从Workspace容器运行artisan命令和其他终端命令
1 - 确认Workspace容器已经运行.
```bash
docker-compose up -d workspace // ..and all your other containers
```
2 - 找到Workspace容器名称:
```bash
docker-compose ps
```
3 - 进入Workspace容器:
```bash
docker-compose exec workspace bash
```
增加 `--user=laradock` (例如 `docker-compose exec --user=laradock workspace bash`) 作为您的主机的用户创建的文件.
4 - 运行任何你想的 :)
```bash
php artisan
```
```bash
Composer update
```
```bash
phpunit
```
<br>
<a name="Use-Redis"></a>
### 使用 Redis
1 - 首先务必用 `docker-compose up` 命令运行 (`redis`)容器.
```bash
docker-compose up -d redis
```
2 - 打开你的Laravel的 `.env` 文件 然后 配置`redis`的`REDIS_HOST`
```env
REDIS_HOST=redis
```
如果在你的`.env` 文件没有找到`REDIS_HOST`变量。打开数据库配置文件`config/database.php`然后用`redis`替换默认IP`127.0.0.1`,例如:
```php
'redis' => [
'cluster' => false,
'default' => [
'host' => 'redis',
'port' => 6379,
'database' => 0,
],
],
```
3 - 启用Redis缓存或者开启Session管理也在`.env`文件中用`redis`替换默认`file`设置`CACHE_DRIVER` 和 `SESSION_DRIVER`
```env
CACHE_DRIVER=redis
SESSION_DRIVER=redis
```
4 - 最好务必通过Compose安装 `predis/predis``(~1.0)`:
```bash
composer require predis/predis:^1.0
```
5 - 你可以用以下代码在Laravel中手动测试
```php
\Cache::store('redis')->put('LaraDock', 'Awesome', 10);
```
<br>
<a name="Use-Mongo"></a>
### 使用 Mongo
1 - 首先在Workspace和PHP-FPM容器中安装`mongo`:
<br>
a) 打开 `docker-compose.yml` 文件
<br>
b) 在Workspace容器中找到`INSTALL_MONGO`选项:
<br>
c) 设置为 `true`
<br>
d) 在PHP-FPM容器中找到`INSTALL_MONGO` <br>
e) 设置为 `true`
相关配置项如下:
```yml
workspace:
build:
context: ./workspace
args:
- INSTALL_MONGO=true
...
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_MONGO=true
...
```
2 - 重建`Workspace、PHP-FPM`容器 `docker-compose build workspace php-fpm`
3 - 使用`docker-compose up` 命令运行MongoDB容器 (`mongo`)
```bash
docker-compose up -d mongo
```
4 - 在`config/database.php` 文件添加MongoDB的配置项:
```php
'connections' => [
'mongodb' => [
'driver' => 'mongodb',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 27017),
'database' => env('DB_DATABASE', 'database'),
'username' => '',
'password' => '',
'options' => [
'database' => '',
]
],
// ...
],
```
5 - 打开Laravel的 `.env` 文件 然后 更新以下字段:
- 设置 `DB_HOST``mongo`的主机IP.
- 设置 `DB_PORT``27017`.
- 设置 `DB_DATABASE``database`.
6 - 最后务必通过Composer安装`jenssegers/mongodb`包添加服务提供者Laravel Service Provider
```bash
composer require jenssegers/mongodb
```
更多细节内容 [点击这儿](https://github.com/jenssegers/laravel-mongodb#installation).
7 - 测试:
- 首先让你的模型继承Mongo的Eloquent Model. 查看 [文档](https://github.com/jenssegers/laravel-mongodb#eloquent).
- 进入Workspace容器.
- 迁移数据库 `php artisan migrate`.
<br>
<a name="PHP"></a>
### [PHP]
<a name="Install-PHP-Extensions"></a>
### 安装PHP拓展
安装PHP扩展之前,你必须决定你是否需要`FPM`或`CLI`,因为他们安装在不同的容器上,如果你需要两者,则必须编辑两个容器。
PHP-FPM拓展务必安装在 `php-fpm/Dockerfile-XX`. *(用你PHP版本号替换 XX)*.
<br>
PHP-CLI拓展应该安装到`workspace/Dockerfile`.
<br>
<a name="Change-the-PHP-FPM-Version"></a>
### 修改PHP-FPM版本
默认运行**PHP-FPM 7.0**版本.
>PHP-FPM负责服务你的应用代码,如果你是计划运行您的应用程序在不同PHP-FPM版本上则不需要更改PHP-CLI版本。
#### A) 切换版本 PHP `7.0` 到 PHP `5.6`
1 - 打开 `docker-compose.yml`
2 - 在PHP容器的 `Dockerfile-70`文件。
3 - 修改版本号, 用`Dockerfile-56`替换 `Dockerfile-70` , 例如:
```txt
php-fpm:
build:
context: ./php-fpm
dockerfile: Dockerfile-70
```
4 - 最后重建PHP容器
```bash
docker-compose build php
```
> 更多关于PHP基础镜像, 请访问 [PHP Docker官方镜像](https://hub.docker.com/_/php/).
#### B) 切换版本 PHP `7.0``5.6` 到 PHP `5.5`
我们已不在本地支持PHP5.5,但是你按照以下步骤获取:
1 - 克隆 `https://github.com/LaraDock/php-fpm`.
3 - 重命名 `Dockerfile-56``Dockerfile-55`.
3 - 编辑文件 `FROM php:5.6-fpm``FROM php:5.5-fpm`.
4 - 从 `Dockerfile-55`构建镜像.
5 - 打开 `docker-compose.yml` 文件.
6 - 将 `php-fpm` 指向你的 `Dockerfile-55` 文件.
<br>
<a name="Change-the-PHP-CLI-Version"></a>
### 修改 PHP-CLI 版本
默认运行**PHP-CLI 7.0**版本
>说明: PHP-CLI只用于执行Artisan和Composer命令不服务于你的应用代码这是PHP-FPM的工作所以编辑PHP-CLI的版本不是很重要。
PHP-CLI安装在Workspace容器改变PHP-CLI版本你需要编辑`workspace/Dockerfile`.
现在你必须手动修改PHP-FPM的`Dockerfile`或者创建一个新的。 (可以考虑贡献功能).
<br>
<a name="Install-xDebug"></a>
### 安装 xDebug
1 - 首先在Workspace和PHP-FPM容器安装 `xDebug`:
<br>
a) 打开 `docker-compose.yml` 文件
<br>
b) 在Workspace容器中找到 `INSTALL_XDEBUG` 选项
<br>
c) 改为 `true`
<br>
d) 在PHP-FPM容器中找到 `INSTALL_XDEBUG ` 选项<br>
e) 改为 `true`
例如:
```yml
workspace:
build:
context: ./workspace
args:
- INSTALL_XDEBUG=true
...
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_XDEBUG=true
...
```
2 - 重建容器 `docker-compose build workspace php-fpm`
<br>
<a name="Misc"></a>
### [Misc]
<br>
<a name="Use-custom-Domain"></a>
### 使用自定义域名 (替换Docker的IP)
假定你的自定义域名是 `laravel.dev`
1 - 打开 `/etc/hosts` 文件 添加以下内容映射你的localhost 地址 `127.0.0.1``laravel.dev` 域名
```bash
127.0.0.1 laravel.dev
```
2 - 打开你的浏览器访问 `{http://laravel.dev}`
你可以在nginx配置文件自定义服务器名称,如下:
```conf
server_name laravel.dev;
```
<br>
<a name="Enable-Global-Composer-Build-Install"></a>
### 安装全局Composer命令
为启用全局Composer Install在容器构建中允许你安装composer的依赖然后构建完成后就是可用的。
1 - 打开 `docker-compose.yml` 文件
2 - 在Workspace容器找到 `COMPOSER_GLOBAL_INSTALL` 选项并设置为 `true`
例如:
```yml
workspace:
build:
context: ./workspace
args:
- COMPOSER_GLOBAL_INSTALL=true
...
```
3 - 现在特价你的依赖关系到 `workspace/composer.json`
4 - 重建Workspace容器 `docker-compose build workspace`
<br>
<a name="Install-Prestissimo"></a>
### 安装 Prestissimo
[Prestissimo](https://github.com/hirak/prestissimo) 是一个平行安装功能的composer插件。
1 - 在安装期间使全局Composer Install 正在运行:
点击这个 [启用全局Composer构建安装](#Enable-Global-Composer-Build-Install) 然后继续步骤1、2.
2 - 添加 prestissimo 依赖到 Composer:
a - 现在打开 `workspace/composer.json` 文件
b - 添加 `"hirak/prestissimo": "^0.3"` 依赖
c - 重建Workspace容器 `docker-compose build workspace`
<br>
<a name="Install-Node"></a>
### 安装 Node + NVM
在Workspace 容器安装 NVM 和 NodeJS
1 - 打开 `docker-compose.yml` 文件
2 - 在Workspace容器找到 `INSTALL_NODE` 选项设为 `true`
例如:
```yml
workspace:
build:
context: ./workspace
args:
- INSTALL_NODE=true
...
```
3 - 重建容器 `docker-compose build workspace`
<br>
<a name="debugging"></a>
### Debugging
*这里是你可能面临的常见问题列表,以及可能的解决方案.*
#### 看到空白页而不是Laravel的欢迎页面!
在Laravel根目录运行下列命令:
```bash
sudo chmod -R 777 storage bootstrap/cache
```
#### 看到 "Welcome to nginx" 而不是 Laravel 应用!
在浏览器使用 `http://127.0.0.1` 替换 `http://localhost`.
#### 看到包含 `address already in use` 的错误
确保你想运行的服务端口(80, 3306, etc.)不是已经被其他程序使用,例如`apache`/`httpd`服务或其他安装的开发工具
<br>
<a name="upgrading-laradock"></a>
### LaraDock 升级
从Docker Toolbox (VirtualBox)移动到Docker Native (for Mac/Windows),需要从 LaraDock v3.* 升级到 v4.*:
1. 停止Docker虚拟机 `docker-machine stop {default}`
2. 安装 Docker [Mac](https://docs.docker.com/docker-for-mac/) 或 [Windows](https://docs.docker.com/docker-for-windows/).
3. 升级 LaraDock 到 `v4.*.*` (`git pull origin master`)
4. 像之前一样使用LaraDock: `docker-compose up -d nginx mysql`.
**说明:** 如果你面临任何上面的问题的最后一步:重建你所有的容器
`docker-compose build --no-cache`
"警告:容器数据可能会丢失!"
<br>
## 贡献
这个小项目是由一个有一个全职工作和很多的职责的人建立的,所以如果你喜欢这个项目,并且发现它需要一个bug修复或支持或新软件或升级任何容器,或其他任何. . 你是非常欢迎,欢迎毫不不犹豫地贡献吧:)
#### 阅读我们的 [贡献说明](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md)
<a name="Help"></a>
## 帮助 & 问题
从聊天室 [Gitter](https://gitter.im/LaraDock/laradock) 社区获取帮助和支持.
你也可以打开Github上的 [issue](https://github.com/laradock/laradock/issues) (将被贴上问题和答案) 或与大家讨论 [Gitter](https://gitter.im/LaraDock/laradock).
Docker或Laravel的特别帮助你可以在[Codementor.io](https://www.codementor.io/mahmoudz)上直接和项目创始人在线沟通
## 关于作者
**创始人:**
- [Mahmoud Zalt](https://github.com/Mahmoudz) (Twitter [@Mahmoud_Zalt](https://twitter.com/Mahmoud_Zalt))
**主要 贡献者:**
- [Zhqagp](https://github.com/zhqagp)
- [Suteepat (tianissimo)](https://github.com/tianissimo)
- [David (davidavz)](https://github.com/davidavz)
- [Lialosiu](https://github.com/lialosiu)
- [Eric Pfeiffer (computerfr33k)](https://github.com/computerfr33k)
- [Orette](https://github.com/orette)
- [Jack Fletcher (Kauhat)](https://github.com/Kauhat)
- [Bo-Yi Wu (appleboy)](https://github.com/appleboy)
- [Amin Mkh (AminMkh)](https://github.com/AminMkh)
- [Matthew Tonkin Dunn (mattythebatty)](https://github.com/mattythebatty)
- [Zhivitsa Kirill (zhikiri)](https://github.com/zhikiri)
- [Benmag](https://github.com/benmag)
**优秀的人:**
- [Contributors](https://github.com/LaraDock/laradock/graphs/contributors)
- [Supporters](https://github.com/LaraDock/laradock/issues?utf8=%E2%9C%93&q=)
## 许可证
[MIT License](https://github.com/laradock/laradock/blob/master/LICENSE) (MIT)

View File

@ -13,10 +13,14 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
![](https://s31.postimg.org/nbettdki3/lara_dock_poster_new.jpg) ![](https://s31.postimg.org/nbettdki3/lara_dock_poster_new.jpg)
<br> <br>
## Contents ## Contents
- [Readme Languages](#)
- [English (Default)](#)
- [Chinese](https://github.com/LaraDock/laradock/blob/master/README-zh.md)
- [Intro](#Intro) - [Intro](#Intro)
- [Features](#features) - [Features](#features)
- [Supported Software's](#Supported-Containers) - [Supported Software's](#Supported-Containers)
@ -44,6 +48,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
- [Run Artisan Commands](#Run-Artisan-Commands) - [Run Artisan Commands](#Run-Artisan-Commands)
- [Use Redis](#Use-Redis) - [Use Redis](#Use-Redis)
- [Use Mongo](#Use-Mongo) - [Use Mongo](#Use-Mongo)
- [Use phpMyAdmin](#Use-phpMyAdmin)
- [PHP](#PHP) - [PHP](#PHP)
- [Install PHP Extensions](#Install-PHP-Extensions) - [Install PHP Extensions](#Install-PHP-Extensions)
- [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version) - [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version)
@ -124,8 +129,10 @@ Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Red
- HHVM - HHVM
- **Message Queueing Systems:** - **Message Queueing Systems:**
- Beanstalkd (+ Beanstalkd Console) - Beanstalkd (+ Beanstalkd Console)
- RabbitMQ (+ RabbitMQ Console)
- **Tools:** - **Tools:**
- Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...) - Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...)
- phpMyAdmin
>If you can't find your Software, build it yourself and add it to this list. Contributions are welcomed :) >If you can't find your Software, build it yourself and add it to this list. Contributions are welcomed :)
@ -187,8 +194,8 @@ What's better than a **Demo Video**:
<a name="Requirements"></a> <a name="Requirements"></a>
## Requirements ## Requirements
- [Git](https://git-scm.com/downloads) - [Git](https://git-scm.com/downloads)
- [Docker](https://www.docker.com/products/docker/) - [Docker](https://www.docker.com/products/docker/) `>= 1.12`
@ -243,7 +250,7 @@ docker-compose up -d nginx mysql
You can select your own combination of Containers form the list below: You can select your own combination of Containers form the list below:
`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`. `nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `workspace`, `phpmyadmin`.
**Note**: `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. **Note**: `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command.
@ -492,7 +499,7 @@ Example using Composer
composer create-project laravel/laravel my-cool-app "5.2.*" composer create-project laravel/laravel my-cool-app "5.2.*"
``` ```
> We recommand using `composer create-project` instead of the Laravel installer, to install Laravel. > We recommend using `composer create-project` instead of the Laravel installer, to install Laravel.
For more about the Laravel installation click [here](https://laravel.com/docs/master#installing-laravel). For more about the Laravel installation click [here](https://laravel.com/docs/master#installing-laravel).
@ -701,6 +708,26 @@ More details about this [here](https://github.com/jenssegers/laravel-mongodb#ins
<br>
<a name="Use-phpMyAdmin"></a>
### Use phpMyAdmin
1 - Run the phpMyAdmin Container (`phpmyadmin`) with the `docker-compose up` command. Example:
```bash
# use with mysql
docker-compose up -d mysql phpmyadmin
# use with mariadb
docker-compose up -d mariadb phpmyadmin
```
2 - Open your browser and visit the localhost on port **8080**: `http://localhost:8080`
<br> <br>
<a name="PHP"></a> <a name="PHP"></a>
@ -867,13 +894,6 @@ To controll the behavior of xDebug (in the `php-fpm` Container), you can run the
<br> <br>
<a name="Misc"></a> <a name="Misc"></a>
@ -983,6 +1003,8 @@ It should be like this:
*Here's a list of the common problems you might face, and the possible solutions.* *Here's a list of the common problems you might face, and the possible solutions.*
#### I see a blank (white) page instead of the Laravel 'Welcome' page! #### I see a blank (white) page instead of the Laravel 'Welcome' page!
Run the following command from the Laravel root directory: Run the following command from the Laravel root directory:
@ -991,16 +1013,27 @@ Run the following command from the Laravel root directory:
sudo chmod -R 777 storage bootstrap/cache sudo chmod -R 777 storage bootstrap/cache
``` ```
#### I see "Welcome to nginx" instead of the Laravel App! #### I see "Welcome to nginx" instead of the Laravel App!
Use `http://127.0.0.1` instead of `http://localhost` in your browser. Use `http://127.0.0.1` instead of `http://localhost` in your browser.
#### I see an error message containing `address already in use` #### I see an error message containing `address already in use`
Make sure the ports for the services that you are trying to run (80, 3306, etc.) are not being used already by other programs, such as a built in `apache`/`httpd` service or other development tools you have installed. Make sure the ports for the services that you are trying to run (80, 3306, etc.) are not being used already by other programs, such as a built in `apache`/`httpd` service or other development tools you have installed.
#### I get Nginx error 404 Not Found on Windows.
1. Go to docker Settings on your Windows machine.
2. Click on the `Shared Drives` tab and check the drive that contains your project files.
3. Enter your windows username and password.
4. Go to the `reset` tab and click restart docker.
@ -1031,7 +1064,7 @@ Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requ
This little project was built by one man who has a full time job and many responsibilities, so if you like this project and you find that it needs a bug fix or support for new software or upgrade any container, or anything else.. Do not hesitate to contribute, you are more than welcome :) This little project was built by one man who has a full time job and many responsibilities, so if you like this project and you find that it needs a bug fix or support for new software or upgrade any container, or anything else.. Do not hesitate to contribute, you are more than welcome :)
#### Read our [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/_guides/contributing.md) #### Read the [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md).
<a name="Help"></a> <a name="Help"></a>
## Help & Questions ## Help & Questions
@ -1050,6 +1083,8 @@ For special help with Docker and/or Laravel, you can schedule a live call with t
**Main Contributors:** **Main Contributors:**
- [Zhqagp](https://github.com/zhqagp)
- [Tim B (tjb328)](https://github.com/tjb328)
- [MidasCodeBreaker](https://github.com/midascodebreaker) - [MidasCodeBreaker](https://github.com/midascodebreaker)
- [Larry Eitel (LarryEitel)](https://github.com/LarryEitel) - [Larry Eitel (LarryEitel)](https://github.com/LarryEitel)
- [Suteepat (tianissimo)](https://github.com/tianissimo) - [Suteepat (tianissimo)](https://github.com/tianissimo)

View File

@ -32,7 +32,6 @@ $root@midascode:~# docker
$root@midascode:~# apt-get install git $root@midascode:~# apt-get install git
$root@midascode:~# git clone https://github.com/laravel/laravel $root@midascode:~# git clone https://github.com/laravel/laravel
$root@midascode:~# cd laravel $root@midascode:~# cd laravel
$root@midascode:~/laravel# git checkout develop
$root@midascode:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git $root@midascode:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
$root@midascode:~/laravel/ cd laradock $root@midascode:~/laravel/ cd laradock
``` ```

View File

@ -9,9 +9,10 @@ rewrite {
ext / ext /
to /index.php?{query} to /index.php?{query}
} }
gzip
browse browse
log stdout log /var/log/caddy/access.log
errors stderr errors /var/log/caddy/error.log
# Uncomment to enable TLS (HTTPS) # Uncomment to enable TLS (HTTPS)
# Change the first list to listen on port 443 when enabling TLS # Change the first list to listen on port 443 when enabling TLS
#tls self_signed #tls self_signed

View File

@ -2,7 +2,9 @@ FROM alpine:3.4
MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com> MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com>
LABEL caddy_version="0.9.0" architecture="amd64" ENV caddy_version=0.9.1
LABEL caddy_version="$caddy_version" architecture="amd64"
RUN apk update \ RUN apk update \
&& apk upgrade \ && apk upgrade \
@ -10,16 +12,13 @@ RUN apk update \
RUN curl --silent --show-error --fail --location \ RUN curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://github.com/mholt/caddy/releases/download/v0.9.0/caddy_linux_amd64.tar.gz" \ "https://github.com/mholt/caddy/releases/download/v$caddy_version/caddy_linux_amd64.tar.gz" \
| tar --no-same-owner -C /usr/bin/ -xz caddy_linux_amd64 \ | tar --no-same-owner -C /usr/bin/ -xz caddy_linux_amd64 \
&& mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \ && mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \
&& chmod 0755 /usr/bin/caddy \ && chmod 0755 /usr/bin/caddy
&& /usr/bin/caddy -version
EXPOSE 80 443 2015 EXPOSE 80 443 2015
WORKDIR /var/www/laravel/public WORKDIR /var/www/laravel/public
ENTRYPOINT ["caddy"] CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"]
CMD ["-conf", "/etc/Caddyfile"]

View File

@ -14,13 +14,17 @@ services:
- INSTALL_DRUSH=false - INSTALL_DRUSH=false
- INSTALL_AEROSPIKE_EXTENSION=false - INSTALL_AEROSPIKE_EXTENSION=false
- COMPOSER_GLOBAL_INSTALL=false - COMPOSER_GLOBAL_INSTALL=false
- INSTALL_WORKSPACE_SSH=false
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- NODE_VERSION=stable
volumes_from: volumes_from:
- volumes_source - volumes_source
extra_hosts: extra_hosts:
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
- "dockerhost:10.0.75.1" - "dockerhost:10.0.75.1"
ports:
- "22:22"
tty: true tty: true
### PHP-FPM Container ####################################### ### PHP-FPM Container #######################################
@ -45,6 +49,8 @@ services:
extra_hosts: extra_hosts:
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
- "dockerhost:10.0.75.1" - "dockerhost:10.0.75.1"
ports:
- "22:22"
environment: environment:
# IMPORTANT: Set the Remote Interpreter entry matching name to `laravel` # IMPORTANT: Set the Remote Interpreter entry matching name to `laravel`
- PHP_IDE_CONFIG="serverName=laravel" - PHP_IDE_CONFIG="serverName=laravel"
@ -200,6 +206,21 @@ services:
links: links:
- php-fpm - php-fpm
### RabbitMQ Container ####################################
rabbitmq:
build: ./rabbitmq
ports:
- "5672:5672"
- "15671:15671"
- "8080:15672"
privileged: true
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
links:
- php-fpm
### Beanstalkd Console Container ############################ ### Beanstalkd Console Container ############################
beanstalkd-console: beanstalkd-console:
@ -221,13 +242,33 @@ services:
- "2015:2015" - "2015:2015"
volumes: volumes:
- ./caddy/Caddyfile:/etc/Caddyfile - ./caddy/Caddyfile:/etc/Caddyfile
- ./logs/caddy:/var/log/caddy
links: links:
- php-fpm - php-fpm
### phpMyAdmin Container ##################################
phpmyadmin:
build: ./phpmyadmin
environment:
PMA_ARBITRARY: 1
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
volumes_from:
- volumes_data
ports:
- "8080:80"
links:
# for mysql container
- "mysql:db"
# for mariadb container
# - "mariadb:db"
### Laravel Application Code Container ###################### ### Laravel Application Code Container ######################
volumes_source: volumes_source:
build: ./volumes/application image: tianon/true
volumes: volumes:
- ../:/var/www/laravel - ../:/var/www/laravel
# Demonstration of how to mount multiple sites # Demonstration of how to mount multiple sites
@ -237,15 +278,15 @@ services:
### Databases Data Container ################################ ### Databases Data Container ################################
volumes_data: volumes_data:
build: ./volumes/data image: tianon/true
volumes: volumes:
- ./data/mysql:/var/lib/mysql - ./data/mysql:/var/lib/mysql
- ./data/postgres:/var/lib/postgres - ./data/postgres:/var/lib/postgres
- ./data/mariadb:/var/lib/mariadb
- ./data/memcached:/var/lib/memcached - ./data/memcached:/var/lib/memcached
- ./data/redis:/data - ./data/redis:/data
- ./data/neo4j:/var/lib/neo4j/data - ./data/neo4j:/var/lib/neo4j/data
- ./data/mongo:/data/db - ./data/mongo:/data/db
- ./data/aerospike:/opt/aerospike/data - ./data/aerospike:/opt/aerospike/data
- ./data/sessions:/sessions
### Add more Containers below ############################### ### Add more Containers below ###############################

View File

@ -41,7 +41,6 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
##################################### #####################################
ARG INSTALL_XDEBUG=true ARG INSTALL_XDEBUG=true
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
RUN if [ ${INSTALL_XDEBUG} = true ]; then \ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension # Install the xdebug extension
pecl install xdebug && \ pecl install xdebug && \
@ -56,7 +55,6 @@ COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
##################################### #####################################
ARG INSTALL_MONGO=true ARG INSTALL_MONGO=true
ENV INSTALL_MONGO ${INSTALL_MONGO}
RUN if [ ${INSTALL_MONGO} = true ]; then \ RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension # Install the mongodb extension
pecl install mongodb && \ pecl install mongodb && \
@ -68,7 +66,6 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
##################################### #####################################
ARG INSTALL_ZIP_ARCHIVE=true ARG INSTALL_ZIP_ARCHIVE=true
ENV INSTALL_ZIP_ARCHIVE ${INSTALL_ZIP_ARCHIVE}
RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
# Install the zip extension # Install the zip extension
pecl install zip && \ pecl install zip && \
@ -80,7 +77,6 @@ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
##################################### #####################################
ARG INSTALL_MEMCACHED=true ARG INSTALL_MEMCACHED=true
ENV INSTALL_MEMCACHED ${INSTALL_MEMCACHED}
RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
# Install the php memcached extension # Install the php memcached extension
pecl install memcached && \ pecl install memcached && \
@ -91,7 +87,6 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
# Opcache: # Opcache:
##################################### #####################################
ARG INSTALL_OPCACHE=true ARG INSTALL_OPCACHE=true
ENV INSTALL_OPCACHE ${INSTALL_OPCACHE}
RUN if [ ${INSTALL_OPCACHE} = true ]; then \ RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache && \ docker-php-ext-install opcache && \
docker-php-ext-enable opcache \ docker-php-ext-enable opcache \

View File

@ -41,7 +41,6 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
##################################### #####################################
ARG INSTALL_XDEBUG=true ARG INSTALL_XDEBUG=true
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
RUN if [ ${INSTALL_XDEBUG} = true ]; then \ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension # Install the xdebug extension
pecl install xdebug && \ pecl install xdebug && \
@ -56,7 +55,6 @@ COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
##################################### #####################################
ARG INSTALL_MONGO=true ARG INSTALL_MONGO=true
ENV INSTALL_MONGO ${INSTALL_MONGO}
RUN if [ ${INSTALL_MONGO} = true ]; then \ RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension # Install the mongodb extension
pecl install mongodb && \ pecl install mongodb && \
@ -68,7 +66,6 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
##################################### #####################################
ARG INSTALL_ZIP_ARCHIVE=true ARG INSTALL_ZIP_ARCHIVE=true
ENV INSTALL_ZIP_ARCHIVE ${INSTALL_ZIP_ARCHIVE}
RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
# Install the zip extension # Install the zip extension
pecl install zip && \ pecl install zip && \
@ -80,7 +77,6 @@ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
##################################### #####################################
ARG INSTALL_MEMCACHED=true ARG INSTALL_MEMCACHED=true
ENV INSTALL_MEMCACHED ${INSTALL_MEMCACHED}
RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
# Install the php memcached extension # Install the php memcached extension
curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
@ -124,7 +120,6 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
# Opcache: # Opcache:
##################################### #####################################
ARG INSTALL_OPCACHE=true ARG INSTALL_OPCACHE=true
ENV INSTALL_OPCACHE ${INSTALL_OPCACHE}
RUN if [ ${INSTALL_OPCACHE} = true ]; then \ RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache && \ docker-php-ext-install opcache && \
docker-php-ext-enable opcache \ docker-php-ext-enable opcache \

9
phpmyadmin/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM phpmyadmin/phpmyadmin
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
# Add volume for sessions to allow session persistence
VOLUME /sessions
# We expose phpMyAdmin on port 80
EXPOSE 80

12
rabbitmq/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
#
# RabbitMQ Dockerfile
#
# https://github.com/dockerfile/rabbitmq
#
# Pull base image.
FROM rabbitmq
RUN rabbitmq-plugins enable --offline rabbitmq_management
EXPOSE 15671 15672

View File

@ -1,7 +0,0 @@
FROM debian:jessie
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
WORKDIR /var/www/laravel
CMD ["true"]

View File

@ -1,5 +0,0 @@
FROM debian:jessie
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
CMD ["true"]

View File

@ -49,6 +49,7 @@ ARG INSTALL_XDEBUG=true
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
RUN if [ ${INSTALL_XDEBUG} = true ]; then \ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Load the xdebug extension only with phpunit commands # Load the xdebug extension only with phpunit commands
apt-get update && \
apt-get install -y --force-yes php7.0-xdebug && \ apt-get install -y --force-yes php7.0-xdebug && \
sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \
@ -56,6 +57,28 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# ADD for REMOTE debugging # ADD for REMOTE debugging
COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini
#####################################
# ssh:
#####################################
# Check if ssh needs to be installed
# See: https://github.com/phusion/baseimage-docker#enabling_ssh
ADD insecure_id_rsa /tmp/id_rsa
ADD insecure_id_rsa.pub /tmp/id_rsa.pub
ARG INSTALL_WORKSPACE_SSH=true
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
rm -f /etc/service/sshd/down && \
cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys \
&& cat /tmp/id_rsa.pub >> /root/.ssh/id_rsa.pub \
&& cat /tmp/id_rsa >> /root/.ssh/id_rsa \
&& rm -f /tmp/id_rsa* \
&& chmod 644 /root/.ssh/authorized_keys /root/.ssh/id_rsa.pub \
&& chmod 400 /root/.ssh/id_rsa \
;fi
##################################### #####################################
# MongoDB: # MongoDB:
##################################### #####################################
@ -119,16 +142,18 @@ USER laradock
##################################### #####################################
# Check if NVM needs to be installed # Check if NVM needs to be installed
ARG NODE_VERSION=stable
ENV NODE_VERSION ${NODE_VERSION}
ARG INSTALL_NODE=true ARG INSTALL_NODE=true
ENV INSTALL_NODE ${INSTALL_NODE} ENV INSTALL_NODE ${INSTALL_NODE}
ENV NVM_DIR /home/laradock/.nvm ENV NVM_DIR /home/laradock/.nvm
RUN if [ ${INSTALL_NODE} = true ]; then \ RUN if [ ${INSTALL_NODE} = true ]; then \
# Install nvm (A Node Version Manager) # Install nvm (A Node Version Manager)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash && \ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.6/install.sh | bash && \
. ~/.nvm/nvm.sh && \ . ~/.nvm/nvm.sh && \
nvm install stable && \ nvm install ${NODE_VERSION} && \
nvm use stable && \ nvm use ${NODE_VERSION} && \
nvm alias stable && \ nvm alias ${NODE_VERSION} && \
npm install -g gulp bower \ npm install -g gulp bower \
;fi ;fi

51
workspace/insecure_id_rsa Normal file
View File

@ -0,0 +1,51 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKQIBAAKCAgEA9LX0DVV8VY0k+d58v+Tqe6LfhniBhBgBJ6/ZIGAFyuhqpyf9
1Dn1ihcZeIBLrC4+IaRq0/xiVcdpyBu3fyGkYnyb57Pi2pOFo/te88j0ReeP5onO
mtDAERCR+Wkzi7kivg4Z4U1KgLeJn3R6WJgV1nUwFwwoPID+UC3RpHcS/TPhgZOL
Sog8dYUXx1fbmOnItJbKUK4Zz883li5LUwPLlmGZbrNYL90l1+s1Q9vlwevye2Wq
zXCvYh6DC3XRYIEnZxrOpDSyUHtAwMJ3HXgkIs3HV1dgPTt972mP29ANaG1MbqAo
retvQMMkPQv+9X96wUq34FEm9aTlT5oS0SQ2Xp3/zUvBSFtfeP7ubJb69bun4/4o
gmHLbdDzYNNFAJ5cm1gwyg95eXvCm5derk8Nf+QBHOlpd2gprVmKcERnrnv4Z1Mz
l6/f0o4UC3wfmQgErfNzfrtJFe54uxuf9OM9dXamcJJOsdUgM1hiZ6e+qYsHeAD9
n7vCqjQJlrMhCGZpkeSUhkuYuLBrkhqIOq2VqKdS8CHzY3TixW7Pq5xdKDpqYGUX
qPHx/j5jpKt4h2j0L1ztwo9nedh1cbRyPp9oiow7twsxyD99b36rGSh35qKN3JBV
uMn6z3F8tIELMD49IyVCGyi2+jn7qbVLEOUr5IsFqFuIq5zt5ShfSi6N7e8CAwEA
AQKCAgA1t2M1Mhiy5uLA/re/n85hCWWrrPQxPNu0DIPK+YkL+2y9+KddWMOvZlau
/uqdhyEYXXEdy38CeV2dE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GinW1wHv7di45I3at2HM
jMtZgWPPIqCBIay0UKysW4eEwXYC9cWg9kPcb2y56zadrKxGZqHOPezH2A1iOuzp
vw0mG0xHUY4Eg5aZxcWB1jMf7bbxTAAMxQiBnw0bPEf5zpWzeKL0obxT/NhCgmV7
/Fqs0GCbXEEgJo0zAVemALOAYRW3pYvt8FoCOopo4ADyfmdWlAvzCy46k7Fo
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,46 @@
PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: imported-openssh-key
Public-Lines: 12
AAAAB3NzaC1yc2EAAAADAQABAAACAQD0tfQNVXxVjST53ny/5Op7ot+GeIGEGAEn
r9kgYAXK6GqnJ/3UOfWKFxl4gEusLj4hpGrT/GJVx2nIG7d/IaRifJvns+Lak4Wj
+17zyPRF54/mic6a0MAREJH5aTOLuSK+DhnhTUqAt4mfdHpYmBXWdTAXDCg8gP5Q
LdGkdxL9M+GBk4tKiDx1hRfHV9uY6ci0lspQrhnPzzeWLktTA8uWYZlus1gv3SXX
6zVD2+XB6/J7ZarNcK9iHoMLddFggSdnGs6kNLJQe0DAwncdeCQizcdXV2A9O33v
aY/b0A1obUxuoCit629AwyQ9C/71f3rBSrfgUSb1pOVPmhLRJDZenf/NS8FIW194
/u5slvr1u6fj/iiCYctt0PNg00UAnlybWDDKD3l5e8Kbl16uTw1/5AEc6Wl3aCmt
WYpwRGeue/hnUzOXr9/SjhQLfB+ZCASt83N+u0kV7ni7G5/04z11dqZwkk6x1SAz
WGJnp76piwd4AP2fu8KqNAmWsyEIZmmR5JSGS5i4sGuSGog6rZWop1LwIfNjdOLF
bs+rnF0oOmpgZReo8fH+PmOkq3iHaPQvXO3Cj2d52HVxtHI+n2iKjDu3CzHIP31v
fqsZKHfmoo3ckFW4yfrPcXy0gQswPj0jJUIbKLb6OfuptUsQ5SvkiwWoW4irnO3l
KF9KLo3t7w==
Private-Lines: 28
AAACADW3YzUyGLLm4sD+t7+fzmEJZaus9DE827QMg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u6fj/iiCYctt0PNg00UAnlybWDDKD3l5e8Kbl16uTw1/5AEc6Wl3aCmtWYpwRGeue/hnUzOXr9/SjhQLfB+ZCASt83N+u0kV7ni7G5/04z11dqZwkk6x1SAzWGJnp76piwd4AP2fu8KqNAmWsyEIZmmR5JSGS5i4sGuSGog6rZWop1LwIfNjdOLFbs+rnF0oOmpgZReo8fH+PmOkq3iHaPQvXO3Cj2d52HVxtHI+n2iKjDu3CzHIP31vfqsZKHfmoo3ckFW4yfrPcXy0gQswPj0jJUIbKLb6OfuptUsQ5SvkiwWoW4irnO3lKF9KLo3t7w== insecure@laradock

View File

@ -6,12 +6,21 @@
# Grab full name of php-fpm container # Grab full name of php-fpm container
PHP_FPM_CONTAINER=$(docker-compose ps | grep php-fpm | cut -d" " -f 1) PHP_FPM_CONTAINER=$(docker-compose ps | grep php-fpm | cut -d" " -f 1)
# Grab OS type
if [[ "$(uname)" == "Darwin" ]]; then
OS_TYPE="OSX"
else
OS_TYPE=$(expr substr $(uname -s) 1 5)
fi
xdebug_status () xdebug_status ()
{ {
echo 'xDebug status' echo 'xDebug status'
# If running on Windows, need to prepend with winpty :( # If running on Windows, need to prepend with winpty :(
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then if [[ $OS_TYPE == "MINGW" ]]; then
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
else else
@ -20,6 +29,7 @@ xdebug_status ()
} }
xdebug_start () xdebug_start ()
{ {
echo 'Start xDebug' echo 'Start xDebug'
@ -30,7 +40,7 @@ xdebug_start ()
# If running on Windows, need to prepend with winpty :( # If running on Windows, need to prepend with winpty :(
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then if [[ $OS_TYPE == "MINGW" ]]; then
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
docker restart $PHP_FPM_CONTAINER docker restart $PHP_FPM_CONTAINER
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
@ -40,9 +50,9 @@ xdebug_start ()
docker restart $PHP_FPM_CONTAINER docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
fi fi
} }
xdebug_stop () xdebug_stop ()
{ {
echo 'Stop xDebug' echo 'Stop xDebug'
@ -52,7 +62,7 @@ xdebug_stop ()
# If running on Windows, need to prepend with winpty :( # If running on Windows, need to prepend with winpty :(
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then if [[ $OS_TYPE == "MINGW" ]]; then
# This is the equivalent of: # This is the equivalent of:
# winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla' # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla'
# Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593 # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593