From 9611fdb58ff4c4fa5cc17c37fd5f98bb28c7370f Mon Sep 17 00:00:00 2001 From: larryeitel Date: Tue, 16 Aug 2016 08:55:29 -0600 Subject: [PATCH 01/23] Indent - Start/Stop xDebug in TOC --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 60f5af8..34615f3 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Install Prestissimo](#Install-Prestissimo) - [Install Node + NVM](#Install-Node) - [Debugging](#debugging) - - [Upgrading LaraDock](#upgrading-laradock) + - [Upgrading LaraDock](#upgrading-laradock) - [Help & Questions](#Help) From 208b2e7c0ab05cc995239e2668a488a135914467 Mon Sep 17 00:00:00 2001 From: larryeitel Date: Tue, 16 Aug 2016 09:23:56 -0600 Subject: [PATCH 02/23] ReTweak README re xdebug --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 34615f3..0b9a60d 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version) - [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version) - [Install xDebug](#Install-xDebug) - - [Start/Stop xDebug](#Controll-xDebug) + - [Start/Stop xDebug](#Controll-xDebug) - [Production](#Production) - [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean) - [Misc](#Misc) @@ -58,7 +58,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Install Prestissimo](#Install-Prestissimo) - [Install Node + NVM](#Install-Node) - [Debugging](#debugging) - - [Upgrading LaraDock](#upgrading-laradock) + - [Upgrading LaraDock](#upgrading-laradock) - [Help & Questions](#Help) From 12ba6bbbaef49cd60b4431acd2108c84841b9043 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 24 Aug 2016 14:25:42 +0800 Subject: [PATCH 03/23] add phpMyAdmin document. Signed-off-by: Bo-Yi Wu --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 3ac1efc..d50d679 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,8 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Start/Stop xDebug](#Controll-xDebug) - [Production](#Production) - [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean) + - [Database](#Database) + - [Use phpMyAdmin](#Use-phpMyAdmin) - [Misc](#Misc) - [Use custom Domain](#Use-custom-Domain) - [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) @@ -868,10 +870,23 @@ To controll the behavior of xDebug (in the `php-fpm` Container), you can run the +
+ +
+ +### Use phpMyAdmin +1 - First make sure you run the phpMyAdmin Container (`phpmyadmin`) with the `docker-compose up` command. +```bash +# use mysql +docker-compose up -d mysql phpmyadmin +# use mariadb +docker-compose up -d mariadb phpmyadmin +``` +2 - Open your browser and visit the localhost: `http://localhost:8080` From 509cb9ac2edac1a423e358393228b5f98aeb9679 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 25 Aug 2016 00:19:58 +0300 Subject: [PATCH 04/23] replace the phpmyadmin guide in the readme --- README.md | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index d50d679..789aa36 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Run Artisan Commands](#Run-Artisan-Commands) - [Use Redis](#Use-Redis) - [Use Mongo](#Use-Mongo) + - [Use phpMyAdmin](#Use-phpMyAdmin) - [PHP](#PHP) - [Install PHP Extensions](#Install-PHP-Extensions) - [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version) @@ -52,8 +53,6 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Start/Stop xDebug](#Controll-xDebug) - [Production](#Production) - [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean) - - [Database](#Database) - - [Use phpMyAdmin](#Use-phpMyAdmin) - [Misc](#Misc) - [Use custom Domain](#Use-custom-Domain) - [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) @@ -704,6 +703,26 @@ More details about this [here](https://github.com/jenssegers/laravel-mongodb#ins +
+ +### 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` + + + + +
@@ -870,26 +889,6 @@ To controll the behavior of xDebug (in the `php-fpm` Container), you can run the -
- - -
- -### Use phpMyAdmin - -1 - First make sure you run the phpMyAdmin Container (`phpmyadmin`) with the `docker-compose up` command. - -```bash -# use mysql -docker-compose up -d mysql phpmyadmin -# use mariadb -docker-compose up -d mariadb phpmyadmin -``` - -2 - Open your browser and visit the localhost: `http://localhost:8080` - - -
From f8d3c58d6ad8fb02fbde5025581ec32870471e80 Mon Sep 17 00:00:00 2001 From: zhqagp Date: Fri, 26 Aug 2016 12:38:51 +0800 Subject: [PATCH 05/23] Create README-zh.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 中文翻译版README --- README-zh.md | 982 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 982 insertions(+) create mode 100644 README-zh.md diff --git a/README-zh.md b/README-zh.md new file mode 100644 index 0000000..7c741ba --- /dev/null +++ b/README-zh.md @@ -0,0 +1,982 @@ +# 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**应用。 +
+就像Laravel Homestead一样,但是Docker替换了Vagrant。 +>先在Docker上使用LaraDock,然后再学习它们。 + +![](https://s31.postimg.org/nbettdki3/lara_dock_poster_new.jpg) + +
+## 目录 + +- [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) + + + + +## 介绍 +LaraDock努力简化创建开发环境过程。 +它包含预包装Docker镜像,提供你一个美妙的开发环境而不需要安装PHP,NGINX,MySQL和其他任何软件在你本地机器上。 + +**使用概览:** + + +让我们了解使用它安装`NGINX`, `PHP`, `Composer`, `MySQL` 和 `Redis`,然后运行`Laravel` + +1. 将LaraDock放到你的Laravel项目中: +
+`git clone https://github.com/LaraDock/laradock.git`. +2. 进入LaraDock目录,然后运行这些容器。 +
+`docker-compose up -d nginx mysql redis` +3. 打开你的`.env`文件,然后设置`mysql`的`DB_HOST` 和 `redis`的`REDIS_HOST`。 +4. 打开浏览器,访问localhost: + + + +### 特点 + +- 在PHP版本:7.0,5.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`) +- 所有的都是可视化和可编辑的 +- 快速的镜像构建 +- 每周都会有更新... + + +### 支持的软件 (容器) + +- **数据库引擎:** + - 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...) +>如果你找不到你需要的软件,构建它然后把它添加到这个列表。你的贡献是受欢迎的。 + + +### Docker是什么? + +[Docker](https://www.docker.com) 是一个开源项目,自动化部署应用程序软件的容器,在Linux, Mac OS and Windows提供一个额外的抽象层和自动化的[操作系统级的虚拟化](https://en.wikipedia.org/wiki/Operating-system-level_virtualization) + + +### Laravel是什么? + +额,这很认真的!!! + + + +### 为什么使用Docker而不是Vagrant!? + +[Vagrant](https://www.vagrantup.com)构建虚拟机需要几分钟然而Docker构建虚拟容器只需要几秒钟。 +而不是提供一个完整的虚拟机,就像你用Vagrant,Docker为您提供**轻量级**虚拟容器,共享相同的内核和允许安全执行独立的进程。 + +除了速度,Docker提供大量的Vagrant无法实现的功能。 + +最重要的是Docker可以运行在开发和生产(相同环境无处不在)。Vagrant是专为开发,(所以在生产环境你必须每一次重建您的服务器)。 + + +### LaraDock Homestead 对比 + +LaraDock and [Homestead](https://laravel.com/docs/master/homestead) 给你一个完整的虚拟开发环境。(不需要安装和配置软件在你自己的每一个操作系统)。 + +Homestead 是一个工具,为你控制虚拟机(使用Homestead特殊命令)。Vagrant可以管理你的管理虚容器。 + +运行一个虚拟容器比运行一整个虚拟机快多了**LaraDock 比 Homestead快多了** + + + + +## 演示视频 +还有什么比**演示视频**好: + +- 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) + + + + +## 依赖 + +- [Git](https://git-scm.com/downloads) +- [Docker](https://www.docker.com/products/docker/) + + + + +## 安装 + + +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 +``` + + + + +## 使用 + + +**请在开始之前阅读:** +如果你正在使用**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**。 + +
+
+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`加上它们. + + + +
+2 - 进入 Workspace 容器, 执行像 (Artisan, Composer, PHPUnit, Gulp, ...)等命令 + +```bash +docker-compose exec workspace bash +``` +
+增加 `--user=laradock` (例如 `docker-compose exec --user=laradock workspace bash`) 作为您的主机的用户创建的文件. (你可以从 `docker-compose.yml`修改 PUID (User id) 和 PGID (group id) 值 ). + + + +
+3 - 编辑 Laravel 的配置. + +如果你还没有安装Laravel项目,请查看 [How to Install Laravel in a Docker Container](#Install-Laravel). + +打开 Laravel的 `.env` 文件 然后 配置 你的`mysql`的`DB_HOST`: + +```env +DB_HOST=mysql +``` + + + + + +
+4 - 打开浏览器访问localhost (`http://localhost/`). + + + +
+**调试**: 如果你碰到任何问题,请查看 [调试](#debugging) 章节 +如果你需要特别支持,请联系我,更多细节在[帮助 & 问题](#Help)章节 + + +
+ +## 文档 + + + +### [Docker] + + + + +### 列出正在运行的容器 +```bash +docker ps +``` +你也可以使用以下命令查看某项目的容器 + + +```bash +docker-compose ps +``` + + + + + +
+ +### 关闭所有容器 +```bash +docker-compose stop +``` + +停止某个容器: + +```bash +docker-compose stop {容器名称} +``` + +
+ +### 删除所有容器 +```bash +docker-compose down +``` + + +小心这个命令,因为它也会删除你的数据容器。(如果你想保留你的数据你应该在上述命令后列出容器名称删除每个容器本身):* + + + + + +
+ +### 进入容器 (通过SSH 进入一个运行中的容器) + +1 - 首先使用 `docker ps`命令查看正在运行的容器 + +2 - 进入某个容器使用: + +```bash +docker-compose exec {container-name} bash +``` + +*例如: 进入 MySQL 容器* + +```bash +docker-compose exec mysql bash +``` + +3 - 退出容器, 键入 `exit`. + + + + + + + +
+ +### 编辑默认容器配置 +打开 `docker-compose.yml` 然后 按照你想的修改. + +例如: + +修改 MySQL 数据库名称: + +```yml + environment: + MYSQL_DATABASE: laradock +``` + +修改 Redis 默认端口为 1111: + +```yml + ports: + - "1111:6379" +``` + + + + + + + + +
+ +### 编辑Docker镜像 + +1 - 找到你想修改的镜像的 `dockerfile` , +
+例如: `mysql` 在 `mysql/Dockerfile`. + +2 - 按你所要的编辑文件. + +3 - 重新构建容器: + +```bash +docker-compose build mysql +``` +更多信息在容器重建中 [点击这里](#Build-Re-build-Containers). + + + + + + + + +
+ +### 建立/重建容器 + + +如果你做任何改变`dockerfile`确保你运行这个命令,可以让所有修改更改生效: + + +```bash +docker-compose build +``` +选择你可以指定哪个容器重建(而不是重建所有的容器): + + +```bash +docker-compose build {container-name} +``` + +如果你想重建整个容器,你可能需要使用 `--no-cache` 选项 (`docker-compose build --no-cache {container-name}`). + + + + + +
+ +### 增加更多软件 (Docker 镜像) + +为了增加镜像(软件), 编辑 `docker-compose.yml` 添加容器细节, 你需要熟悉 [docker compose 文件语法](https://docs.docker.com/compose/compose-file/). + + + + + + + + + +
+ +### 查看日志文件 +Nginx的日志在 `logs/nginx` 目录 + +然后查看其它容器日志(MySQL, PHP-FPM,...) 你可以运行: + +```bash +docker logs {container-name} +``` + + + + + +
+ +### [Laravel] + + + + + +### 从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`的文件。 + +
+ +### 运行 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 +``` + +
+ +### 使用 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); +``` + + + + + +
+ +### 使用 Mongo + +1 - 首先在Workspace和PHP-FPM容器中安装`mongo`: +
+a) 打开 `docker-compose.yml` 文件 +
+b) 在Workspace容器中找到`INSTALL_MONGO`选项: + +
+c) 设置为 `true` +
+d) 在PHP-FPM容器中找到`INSTALL_MONGO`
+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`. + + + + + + +
+ +### [PHP] + + + + + + + +### 安装PHP拓展 +安装PHP扩展之前,你必须决定你是否需要`FPM`或`CLI`,因为他们安装在不同的容器上,如果你需要两者,则必须编辑两个容器。 + +PHP-FPM拓展务必安装在 `php-fpm/Dockerfile-XX`. *(用你PHP版本号替换 XX)*. +
+PHP-CLI拓展应该安装到`workspace/Dockerfile`. + + +
+ +### 修改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` 文件. + + + + + + + + + + + + +
+ +### 修改 PHP-CLI 版本 +默认运行**PHP-CLI 7.0**版本 + +>说明: PHP-CLI只用于执行Artisan和Composer命令,不服务于你的应用代码,这是PHP-FPM的工作,所以编辑PHP-CLI的版本不是很重要。 +PHP-CLI安装在Workspace容器,改变PHP-CLI版本你需要编辑`workspace/Dockerfile`. +现在你必须手动修改PHP-FPM的`Dockerfile`或者创建一个新的。 (可以考虑贡献功能). + + + + +
+ +### 安装 xDebug + +1 - 首先在Workspace和PHP-FPM容器安装 `xDebug`: +
+a) 打开 `docker-compose.yml` 文件 +
+b) 在Workspace容器中找到 `INSTALL_XDEBUG` 选项 +
+c) 改为 `true` +
+d) 在PHP-FPM容器中找到 `INSTALL_XDEBUG ` 选项
+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` + + + +
+ +### [Misc] + + +
+ +### 使用自定义域名 (替换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; +``` + + + +
+ +### 安装全局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` + + + + +
+ +### 安装 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` + + + + +
+ +### 安装 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` + + + +
+ +### 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`服务或其他安装的开发工具 + + +
+ +### 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` +"警告:容器数据可能会丢失!" + + + + + + + +
+## 贡献 +这个小项目是由一个有一个全职工作和很多的职责的人建立的,所以如果你喜欢这个项目,并且发现它需要一个bug修复或支持或新软件或升级任何容器,或其他任何. . 你是非常欢迎,欢迎毫不不犹豫地贡献吧:) + +#### 阅读我们的 [贡献说明](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md) + + +## 帮助 & 问题 + +从聊天室 [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)) + +**主要 贡献者:** + +- [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) From 740b4647a3b59f316a9890f46d4842115130fe52 Mon Sep 17 00:00:00 2001 From: Helson Taveras Date: Fri, 26 Aug 2016 11:29:32 -0400 Subject: [PATCH 06/23] Laravel 5.3 is published officially No need for development branch switch. Ran into the same error posted by this guy here https://laracasts.com/discuss/channels/laravel/laravel-53-cant-do-php-artisan-optimize. I didn't switch to the development branch and the setup worked perfectly. --- _guides/digital_ocean.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_guides/digital_ocean.md b/_guides/digital_ocean.md index 3f47e52..0ff32ff 100644 --- a/_guides/digital_ocean.md +++ b/_guides/digital_ocean.md @@ -32,7 +32,6 @@ $root@midascode:~# docker $root@midascode:~# apt-get install git $root@midascode:~# git clone https://github.com/laravel/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/ cd laradock ``` From f9fd3918791a99586d06b08501e967591590766d Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Fri, 26 Aug 2016 13:25:31 -0500 Subject: [PATCH 07/23] update caddy to v0.9.1 --- caddy/Dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/caddy/Dockerfile b/caddy/Dockerfile index 9bf05ec..b195d68 100644 --- a/caddy/Dockerfile +++ b/caddy/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.4 MAINTAINER Eric Pfeiffer -LABEL caddy_version="0.9.0" architecture="amd64" +LABEL caddy_version="0.9.1" architecture="amd64" RUN apk update \ && apk upgrade \ @@ -10,7 +10,7 @@ RUN apk update \ RUN curl --silent --show-error --fail --location \ --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/v0.9.1/caddy_linux_amd64.tar.gz" \ | tar --no-same-owner -C /usr/bin/ -xz caddy_linux_amd64 \ && mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \ && chmod 0755 /usr/bin/caddy \ @@ -20,6 +20,4 @@ EXPOSE 80 443 2015 WORKDIR /var/www/laravel/public -ENTRYPOINT ["caddy"] - -CMD ["-conf", "/etc/Caddyfile"] +CMD ["caddy" "-conf", "/etc/Caddyfile"] From 29d714a84912f895237e2dffc9ffcd1ce8d24066 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Fri, 26 Aug 2016 13:26:22 -0500 Subject: [PATCH 08/23] caddy log to file. enable gzip compression. --- caddy/Caddyfile | 5 +++-- docker-compose.yml | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/caddy/Caddyfile b/caddy/Caddyfile index 5052db3..f3c5434 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -9,9 +9,10 @@ rewrite { ext / to /index.php?{query} } +gzip browse -log stdout -errors stderr +log /var/log/caddy/access.log +errors /var/log/caddy/error.log # Uncomment to enable TLS (HTTPS) # Change the first list to listen on port 443 when enabling TLS #tls self_signed diff --git a/docker-compose.yml b/docker-compose.yml index 8f8eb32..ecc4fde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -206,6 +206,7 @@ services: - "2015:2015" volumes: - ./caddy/Caddyfile:/etc/Caddyfile + - ./logs/caddy:/var/log/caddy links: - php-fpm From b25255856015249a7026e6fa353692da9657ed7c Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Fri, 26 Aug 2016 14:01:48 -0500 Subject: [PATCH 09/23] fix caddy Dockerfile from previous commit. --- caddy/Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/caddy/Dockerfile b/caddy/Dockerfile index b195d68..7055968 100644 --- a/caddy/Dockerfile +++ b/caddy/Dockerfile @@ -2,7 +2,9 @@ FROM alpine:3.4 MAINTAINER Eric Pfeiffer -LABEL caddy_version="0.9.1" architecture="amd64" +ENV caddy_version=0.9.1 + +LABEL caddy_version="$caddy_version" architecture="amd64" RUN apk update \ && apk upgrade \ @@ -10,14 +12,13 @@ RUN apk update \ RUN curl --silent --show-error --fail --location \ --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ - "https://github.com/mholt/caddy/releases/download/v0.9.1/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 \ && mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \ - && chmod 0755 /usr/bin/caddy \ - && /usr/bin/caddy -version + && chmod 0755 /usr/bin/caddy EXPOSE 80 443 2015 WORKDIR /var/www/laravel/public -CMD ["caddy" "-conf", "/etc/Caddyfile"] +CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"] From 0cf12c738326ee148ea514d6ec33b1a84c3548d8 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 27 Aug 2016 08:57:03 +0300 Subject: [PATCH 10/23] update the readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 789aa36..a5b6967 100644 --- a/README.md +++ b/README.md @@ -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) + +
## Contents - +- [Readme Languages](#) + - [English (Default)](#) + - [Chinese](https://github.com/LaraDock/laradock/blob/master/README-zh.md) - [Intro](#Intro) - [Features](#features) - [Supported Software's](#Supported-Containers) @@ -190,7 +194,7 @@ What's better than a **Demo Video**: ## Requirements - [Git](https://git-scm.com/downloads) -- [Docker](https://www.docker.com/products/docker/) +- [Docker](https://www.docker.com/products/docker/) `>= 1.12` @@ -1065,6 +1069,8 @@ For special help with Docker and/or Laravel, you can schedule a live call with t **Main Contributors:** +- [Zhqagp](https://github.com/zhqagp) +- [Tim B (tjb328)](https://github.com/tjb328) - [MidasCodeBreaker](https://github.com/midascodebreaker) - [Larry Eitel (LarryEitel)](https://github.com/LarryEitel) - [Suteepat (tianissimo)](https://github.com/tianissimo) From 3ad474a2d913943faf6290ccfb2e969d0060fe9f Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 27 Aug 2016 09:06:22 +0300 Subject: [PATCH 11/23] move contributing to the root --- _guides/contributing.md => CONTRIBUTING.md | 0 README-zh.md | 1 + README.md | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) rename _guides/contributing.md => CONTRIBUTING.md (100%) diff --git a/_guides/contributing.md b/CONTRIBUTING.md similarity index 100% rename from _guides/contributing.md rename to CONTRIBUTING.md diff --git a/README-zh.md b/README-zh.md index 7c741ba..4691e12 100644 --- a/README-zh.md +++ b/README-zh.md @@ -959,6 +959,7 @@ Docker或Laravel的特别帮助,你可以在[Codementor.io](https://www.codeme **主要 贡献者:** +- [Zhqagp](https://github.com/zhqagp) - [Suteepat (tianissimo)](https://github.com/tianissimo) - [David (davidavz)](https://github.com/davidavz) - [Lialosiu](https://github.com/lialosiu) diff --git a/README.md b/README.md index a5b6967..3212d8d 100644 --- a/README.md +++ b/README.md @@ -1050,7 +1050,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 :) -#### 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). ## Help & Questions From 5a980b1c9736fd6cec7391f0f2ddce0579f18ef8 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 27 Aug 2016 10:00:09 +0300 Subject: [PATCH 12/23] add debugging steps for thr 404 windows error --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 3212d8d..1363025 100644 --- a/README.md +++ b/README.md @@ -1002,6 +1002,8 @@ It should be like this: *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! Run the following command from the Laravel root directory: @@ -1010,16 +1012,27 @@ Run the following command from the Laravel root directory: sudo chmod -R 777 storage bootstrap/cache ``` + #### I see "Welcome to nginx" instead of the Laravel App! Use `http://127.0.0.1` instead of `http://localhost` in your browser. + + #### 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. +#### 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. + + From 78be0b577e3d59223cfd4f5ad87f83843a91abd3 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 27 Aug 2016 19:38:44 +0800 Subject: [PATCH 13/23] support specific node version Signed-off-by: Bo-Yi Wu --- docker-compose.yml | 1 + workspace/Dockerfile | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ecc4fde..5f88696 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: - INSTALL_WORKSPACE_SSH=false - PUID=1000 - PGID=1000 + - NODE_VERSION=stable volumes_from: - volumes_source extra_hosts: diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 926615b..f52020a 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -141,6 +141,8 @@ USER laradock ##################################### # Check if NVM needs to be installed +ARG NODE_VERSION=stable +ENV NODE_VERSION ${NODE_VERSION} ARG INSTALL_NODE=true ENV INSTALL_NODE ${INSTALL_NODE} ENV NVM_DIR /home/laradock/.nvm @@ -148,9 +150,9 @@ RUN if [ ${INSTALL_NODE} = true ]; then \ # Install nvm (A Node Version Manager) curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash && \ . ~/.nvm/nvm.sh && \ - nvm install stable && \ - nvm use stable && \ - nvm alias stable && \ + nvm install ${NODE_VERSION} && \ + nvm use ${NODE_VERSION} && \ + nvm alias ${NODE_VERSION} && \ npm install -g gulp bower \ ;fi From 294fe31a801011740b8cadd007fc8512a1811e86 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 27 Aug 2016 22:54:59 +0800 Subject: [PATCH 14/23] update nvm version. Signed-off-by: Bo-Yi Wu --- workspace/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index f52020a..bc0ef16 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -148,7 +148,7 @@ ENV INSTALL_NODE ${INSTALL_NODE} ENV NVM_DIR /home/laradock/.nvm RUN if [ ${INSTALL_NODE} = true ]; then \ # 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 install ${NODE_VERSION} && \ nvm use ${NODE_VERSION} && \ From 6ba76da7099e314b50b3bf0f2dee5dcf2ec6f640 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Sat, 27 Aug 2016 13:18:13 -0500 Subject: [PATCH 15/23] use docker image which only supplies true & echo binaries. --- docker-compose.yml | 4 ++-- volumes/application/Dockerfile | 7 ------- volumes/data/Dockerfile | 5 ----- 3 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 volumes/application/Dockerfile delete mode 100644 volumes/data/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index ecc4fde..9ff2c2c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -232,7 +232,7 @@ services: ### Laravel Application Code Container ###################### volumes_source: - build: ./volumes/application + image: tianon/true volumes: - ../:/var/www/laravel # Demonstration of how to mount multiple sites @@ -242,7 +242,7 @@ services: ### Databases Data Container ################################ volumes_data: - build: ./volumes/data + image: tianon/true volumes: - ./data/mysql:/var/lib/mysql - ./data/postgres:/var/lib/postgres diff --git a/volumes/application/Dockerfile b/volumes/application/Dockerfile deleted file mode 100644 index 33c1966..0000000 --- a/volumes/application/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM debian:jessie - -MAINTAINER Mahmoud Zalt - -WORKDIR /var/www/laravel - -CMD ["true"] diff --git a/volumes/data/Dockerfile b/volumes/data/Dockerfile deleted file mode 100644 index 15869d3..0000000 --- a/volumes/data/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM debian:jessie - -MAINTAINER Mahmoud Zalt - -CMD ["true"] From 227c8da17c90fb46b0a9b9fd0b34956162416f5f Mon Sep 17 00:00:00 2001 From: larryeitel Date: Sat, 27 Aug 2016 16:54:39 -0600 Subject: [PATCH 16/23] Expose port 22 for workspace ssh. Add private key for PHPStorm Windows users. --- docker-compose.yml | 2 ++ workspace/insecure_id_rsa.ppk | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 workspace/insecure_id_rsa.ppk diff --git a/docker-compose.yml b/docker-compose.yml index ecc4fde..59f66d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,8 @@ services: extra_hosts: # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) - "dockerhost:10.0.75.1" + ports: + - "22:22" tty: true ### PHP-FPM Container ####################################### diff --git a/workspace/insecure_id_rsa.ppk b/workspace/insecure_id_rsa.ppk new file mode 100644 index 0000000..0c29627 --- /dev/null +++ b/workspace/insecure_id_rsa.ppk @@ -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+fzmEJZaus9DE827QMg8r5iQv7bL34p11Yw69mVq7+ +6p2HIRhdcR3LfwJ5XZ0RiHwdtGnyFH8OG7QDQgi2+ybka8qUhCAFDBcrz51vV7u5 +/hijsR6rFb9BKiOLJmicNucPq2uCGeZVQtfVMP4EsMo7YS23n77D1oWr1imt54RY +otm0J9yMZSjEruHRCNCspNg6Mwx1rCqCr88B6na1KOIWeR7SXk38CTxDihwtunJf +kHBwqWeWmNmuv52vEI2/okoTv0rshN+FTJjkYEaXk36a8vaDV43JFmTnE2rR6ziD +U5osO5QGhMp2xeiSI8wPdCX4nv5EKgL0+4a610IAhTa70KgUB8ommwqH6wZHKuLO +8PmGVLfUXvzOJ/tbm5uL2y6kDp60lhsr6bBwOwmCa1z6rnXGwfdPU4O9Fxu3O9gU +TwnO5yE3ho+2xj5b/BpMNUN3KYW89KxiNfsGWrd+emDa4kq3NYQhAT6tjuALes2g +1IThgVsgCNMziQi4gWeRWrejYGZDtYeNvdRJ6WEXEE8nrucEwtLdKFcuPKK7bZTx +HEpxs4qkSKa4IpFJUR2mw2emzeHbLxzY89ZZLssbMCIJ6kuNfCoct7gv9y/HxL0p +lFdCd5qSQpOiC5Xs32nQ72muMlyRviOj3jWJoN6lVkgdu4/xAAABAQD68AEIqefw +8DhFaLE9wjJuPqJCkc/O3q5nG/eKXcihjcCebb4QduWgT1VwfemFAQChNCzF36Sh +y0cep0mLpjE5OaaweXeOKUDeQqDQDtGKfvTYM5sLdz1VI57tX2uLM9CcV7CTIM+a +k6hbdvLQNi/QMW0DzM1+BKQV6pkSgGdDIyib2UFhwn1UquJR90K8+CHdlX9LMR9y +npm0wtG+0RbM7HvlzDDqQu9S5R6RCX/tRuvfo7P7vUHrpU3n251Itg8Bv6y3OFtB +JTsts0pouXKAFESqdN5eP5UJcaevE5FlLUV+o726dvGD8VgEMEy3/aNe3oSXPrZi +CMMS0aNxMD+tAAABAQD5pcpbrO58MbzwM+xfmmyXsK7YXCGrWPlQsa+mS65xpWyy +c42YWqLiMfssRlWMRweDoaEOobK1ppSvUqFdVa22fSibapkgoWDsFHsTk9H0cq4i +DR2jryk9//kwpPpMqrWAHWXwHjzV1Vzy2ZoeMdsvP1SUh/y4ttd8/URjIAMConjG +1A206Pu7PSTlrIiBZTqxwYLcSUtPN9a6xc8nJYU1XnAC0IjRe7hT8h007SsuIEjw +FILxULgxrD9rVljWeWJcF+Oa0neLsDazfr5gbXW9eaLYEoVdrzQEzv4v3Om3F/Y+ +/sfVi/LHht9VnbEJMsLKO1SPjAYaSYcxMLwzSCeLAAABAQC/gAQCLbqo4FylEVST +3IP8rxA5RGbLRDJ2j+ywEzOuy2ufGI/CfxeG/+jF5E0/uBRm8rrnMmaJaNr42hF4 +r5kjNM5uficOVucU3FluQqae73zfUFeAQBft+4tTH+sR8jo+LvEBGinW1wHv7di4 +5I3at2HMjMtZgWPPIqCBIay0UKysW4eEwXYC9cWg9kPcb2y56zadrKxGZqHOPezH +2A1iOuzpvw0mG0xHUY4Eg5aZxcWB1jMf7bbxTAAMxQiBnw0bPEf5zpWzeKL0obxT +/NhCgmV7/Fqs0GCbXEEgJo0zAVemALOAYRW3pYvt8FoCOopo4ADyfmdWlAvzCy46 +k7Fo +Private-MAC: 4ea4cef3fa63f1068dcd512c477c61dd7e85bb38 From d44142785276eea4803cb1a2a39fabe07980817b Mon Sep 17 00:00:00 2001 From: larryeitel Date: Sat, 27 Aug 2016 17:22:36 -0600 Subject: [PATCH 17/23] Expose port 22 for workspace ssh. Add private key for PHPStorm Windows users. --- docker-compose.yml | 2 ++ workspace/insecure_id_rsa.ppk | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 workspace/insecure_id_rsa.ppk diff --git a/docker-compose.yml b/docker-compose.yml index ecc4fde..7d6e02b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,6 +44,8 @@ services: extra_hosts: # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) - "dockerhost:10.0.75.1" + ports: + - "22:22" environment: # IMPORTANT: Set the Remote Interpreter entry matching name to `laravel` - PHP_IDE_CONFIG="serverName=laravel" diff --git a/workspace/insecure_id_rsa.ppk b/workspace/insecure_id_rsa.ppk new file mode 100644 index 0000000..0c29627 --- /dev/null +++ b/workspace/insecure_id_rsa.ppk @@ -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+fzmEJZaus9DE827QMg8r5iQv7bL34p11Yw69mVq7+ +6p2HIRhdcR3LfwJ5XZ0RiHwdtGnyFH8OG7QDQgi2+ybka8qUhCAFDBcrz51vV7u5 +/hijsR6rFb9BKiOLJmicNucPq2uCGeZVQtfVMP4EsMo7YS23n77D1oWr1imt54RY +otm0J9yMZSjEruHRCNCspNg6Mwx1rCqCr88B6na1KOIWeR7SXk38CTxDihwtunJf +kHBwqWeWmNmuv52vEI2/okoTv0rshN+FTJjkYEaXk36a8vaDV43JFmTnE2rR6ziD +U5osO5QGhMp2xeiSI8wPdCX4nv5EKgL0+4a610IAhTa70KgUB8ommwqH6wZHKuLO +8PmGVLfUXvzOJ/tbm5uL2y6kDp60lhsr6bBwOwmCa1z6rnXGwfdPU4O9Fxu3O9gU +TwnO5yE3ho+2xj5b/BpMNUN3KYW89KxiNfsGWrd+emDa4kq3NYQhAT6tjuALes2g +1IThgVsgCNMziQi4gWeRWrejYGZDtYeNvdRJ6WEXEE8nrucEwtLdKFcuPKK7bZTx +HEpxs4qkSKa4IpFJUR2mw2emzeHbLxzY89ZZLssbMCIJ6kuNfCoct7gv9y/HxL0p +lFdCd5qSQpOiC5Xs32nQ72muMlyRviOj3jWJoN6lVkgdu4/xAAABAQD68AEIqefw +8DhFaLE9wjJuPqJCkc/O3q5nG/eKXcihjcCebb4QduWgT1VwfemFAQChNCzF36Sh +y0cep0mLpjE5OaaweXeOKUDeQqDQDtGKfvTYM5sLdz1VI57tX2uLM9CcV7CTIM+a +k6hbdvLQNi/QMW0DzM1+BKQV6pkSgGdDIyib2UFhwn1UquJR90K8+CHdlX9LMR9y +npm0wtG+0RbM7HvlzDDqQu9S5R6RCX/tRuvfo7P7vUHrpU3n251Itg8Bv6y3OFtB +JTsts0pouXKAFESqdN5eP5UJcaevE5FlLUV+o726dvGD8VgEMEy3/aNe3oSXPrZi +CMMS0aNxMD+tAAABAQD5pcpbrO58MbzwM+xfmmyXsK7YXCGrWPlQsa+mS65xpWyy +c42YWqLiMfssRlWMRweDoaEOobK1ppSvUqFdVa22fSibapkgoWDsFHsTk9H0cq4i +DR2jryk9//kwpPpMqrWAHWXwHjzV1Vzy2ZoeMdsvP1SUh/y4ttd8/URjIAMConjG +1A206Pu7PSTlrIiBZTqxwYLcSUtPN9a6xc8nJYU1XnAC0IjRe7hT8h007SsuIEjw +FILxULgxrD9rVljWeWJcF+Oa0neLsDazfr5gbXW9eaLYEoVdrzQEzv4v3Om3F/Y+ +/sfVi/LHht9VnbEJMsLKO1SPjAYaSYcxMLwzSCeLAAABAQC/gAQCLbqo4FylEVST +3IP8rxA5RGbLRDJ2j+ywEzOuy2ufGI/CfxeG/+jF5E0/uBRm8rrnMmaJaNr42hF4 +r5kjNM5uficOVucU3FluQqae73zfUFeAQBft+4tTH+sR8jo+LvEBGinW1wHv7di4 +5I3at2HMjMtZgWPPIqCBIay0UKysW4eEwXYC9cWg9kPcb2y56zadrKxGZqHOPezH +2A1iOuzpvw0mG0xHUY4Eg5aZxcWB1jMf7bbxTAAMxQiBnw0bPEf5zpWzeKL0obxT +/NhCgmV7/Fqs0GCbXEEgJo0zAVemALOAYRW3pYvt8FoCOopo4ADyfmdWlAvzCy46 +k7Fo +Private-MAC: 4ea4cef3fa63f1068dcd512c477c61dd7e85bb38 From ea047e2587b3d60e2e70e02a652e4c1dc2dd821f Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Sun, 28 Aug 2016 00:04:19 -0500 Subject: [PATCH 18/23] remove unnecessary env commands These environment variables are not needed since they are only being used at build time and we are already specifying them using the ARG command, no need to specify it twice since it increases build time and size. --- php-fpm/Dockerfile-70 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index fe41277..af39aa4 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -41,7 +41,6 @@ MAINTAINER Mahmoud Zalt ##################################### ARG INSTALL_XDEBUG=true -ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # Install the xdebug extension pecl install xdebug && \ @@ -56,7 +55,6 @@ COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini ##################################### ARG INSTALL_MONGO=true -ENV INSTALL_MONGO ${INSTALL_MONGO} RUN if [ ${INSTALL_MONGO} = true ]; then \ # Install the mongodb extension pecl install mongodb && \ @@ -68,7 +66,6 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ ##################################### ARG INSTALL_ZIP_ARCHIVE=true -ENV INSTALL_ZIP_ARCHIVE ${INSTALL_ZIP_ARCHIVE} RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ # Install the zip extension pecl install zip && \ @@ -80,7 +77,6 @@ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ ##################################### ARG INSTALL_MEMCACHED=true -ENV INSTALL_MEMCACHED ${INSTALL_MEMCACHED} RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ # Install the php memcached extension curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ @@ -102,7 +98,6 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ # Opcache: ##################################### ARG INSTALL_OPCACHE=true -ENV INSTALL_OPCACHE ${INSTALL_OPCACHE} RUN if [ ${INSTALL_OPCACHE} = true ]; then \ docker-php-ext-install opcache && \ docker-php-ext-enable opcache \ From 314e43bb79374e50bd5fdd34ee8153c094740901 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Sun, 28 Aug 2016 00:04:52 -0500 Subject: [PATCH 19/23] Update Dockerfile-56 --- php-fpm/Dockerfile-56 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index 60a67a2..ea390a1 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -41,7 +41,6 @@ MAINTAINER Mahmoud Zalt ##################################### ARG INSTALL_XDEBUG=true -ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # Install the xdebug extension pecl install xdebug && \ @@ -56,7 +55,6 @@ COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini ##################################### ARG INSTALL_MONGO=true -ENV INSTALL_MONGO ${INSTALL_MONGO} RUN if [ ${INSTALL_MONGO} = true ]; then \ # Install the mongodb extension pecl install mongodb && \ @@ -68,7 +66,6 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ ##################################### ARG INSTALL_ZIP_ARCHIVE=true -ENV INSTALL_ZIP_ARCHIVE ${INSTALL_ZIP_ARCHIVE} RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ # Install the zip extension pecl install zip && \ @@ -80,7 +77,6 @@ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ ##################################### ARG INSTALL_MEMCACHED=true -ENV INSTALL_MEMCACHED ${INSTALL_MEMCACHED} RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ # Install the php memcached extension pecl install memcached && \ @@ -91,7 +87,6 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ # Opcache: ##################################### ARG INSTALL_OPCACHE=true -ENV INSTALL_OPCACHE ${INSTALL_OPCACHE} RUN if [ ${INSTALL_OPCACHE} = true ]; then \ docker-php-ext-install opcache && \ docker-php-ext-enable opcache \ From 1e5d604470c339791716bdca5a20875db6c73643 Mon Sep 17 00:00:00 2001 From: Benjamin Katznelson Date: Sun, 28 Aug 2016 18:12:55 +1000 Subject: [PATCH 20/23] Added support for RabbitMQ --- README.md | 3 ++- docker-compose.yml | 15 +++++++++++++++ rabbitmq/Dockerfile | 12 ++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 rabbitmq/Dockerfile diff --git a/README.md b/README.md index 1363025..89d98d4 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Red - HHVM - **Message Queueing Systems:** - Beanstalkd (+ Beanstalkd Console) + - RabbitMQ (+ RabbitMQ Console) - **Tools:** - Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...) - phpMyAdmin @@ -249,7 +250,7 @@ docker-compose up -d nginx mysql 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`, `phpmyadmin`. +`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. diff --git a/docker-compose.yml b/docker-compose.yml index ecc4fde..3a63c12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -185,6 +185,21 @@ services: links: - 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: diff --git a/rabbitmq/Dockerfile b/rabbitmq/Dockerfile new file mode 100644 index 0000000..1bdd485 --- /dev/null +++ b/rabbitmq/Dockerfile @@ -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 \ No newline at end of file From 7b2ff6dab8797d004f24428d7cc3a54bb8aaf6d6 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 30 Aug 2016 13:16:18 +0800 Subject: [PATCH 21/23] fix #267 phpmyadmin is not working on linux. Signed-off-by: Bo-Yi Wu --- phpmyadmin/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/phpmyadmin/Dockerfile b/phpmyadmin/Dockerfile index 87cb30b..8def60c 100644 --- a/phpmyadmin/Dockerfile +++ b/phpmyadmin/Dockerfile @@ -7,5 +7,3 @@ VOLUME /sessions # We expose phpMyAdmin on port 80 EXPOSE 80 - -ENTRYPOINT [ "/run.sh" ] From b42ad1ae7ed3b450cf17e1fd9011dd3127d6525d Mon Sep 17 00:00:00 2001 From: larryeitel Date: Tue, 30 Aug 2016 11:26:54 -0600 Subject: [PATCH 22/23] fix workspace xdebug install bug - need to add apt-get update. --- workspace/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index bc0ef16..97e3f03 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -49,6 +49,7 @@ ARG INSTALL_XDEBUG=true ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # Load the xdebug extension only with phpunit commands + apt-get update && \ apt-get install -y --force-yes php7.0-xdebug && \ 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 \ From ffce0f93d55807a2863756bbf5b259285315717d Mon Sep 17 00:00:00 2001 From: larryeitel Date: Wed, 31 Aug 2016 05:52:03 -0600 Subject: [PATCH 23/23] Fix: ERROR: expr: syntax error #272 --- xdebugPhpFpm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xdebugPhpFpm b/xdebugPhpFpm index 1a343ce..d1e7513 100644 --- a/xdebugPhpFpm +++ b/xdebugPhpFpm @@ -6,12 +6,21 @@ # Grab full name of php-fpm container 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 () { echo 'xDebug status' # 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' else @@ -20,6 +29,7 @@ xdebug_status () } + xdebug_start () { echo 'Start xDebug' @@ -30,7 +40,7 @@ xdebug_start () # 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}" docker restart $PHP_FPM_CONTAINER winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' @@ -40,9 +50,9 @@ xdebug_start () docker restart $PHP_FPM_CONTAINER docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' fi - } + xdebug_stop () { echo 'Stop xDebug' @@ -52,7 +62,7 @@ xdebug_stop () # 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: # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla' # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593