Compare commits
152 Commits
Author | SHA1 | Date | |
---|---|---|---|
0ad1e58bf0 | |||
0cf12c7383 | |||
4e0af7e0cb | |||
d6b091df96 | |||
506fe598cd | |||
b252558560 | |||
29d714a849 | |||
f9fd391879 | |||
740b4647a3 | |||
f8d3c58d6a | |||
509cb9ac2e | |||
f2aea63d64 | |||
12ba6bbbae | |||
9fb50b2c6b | |||
df1a019f75 | |||
c68f70d2a7 | |||
002b147b23 | |||
314034255a | |||
3c8861d1d2 | |||
2d51548879 | |||
4aa3902f32 | |||
fb049ef300 | |||
e75da747a9 | |||
dd48592d8b | |||
d57a0c3888 | |||
7a13e4a343 | |||
4e7e003e87 | |||
9a77c8e276 | |||
080cc2a88a | |||
b648f1ca58 | |||
cfc81fca64 | |||
928451ae88 | |||
95ef5e1e70 | |||
c324114b7a | |||
5ee1fdd71b | |||
7680e29bc5 | |||
b42f24c50d | |||
1c22c009e7 | |||
380c7bd1ec | |||
e8562272b0 | |||
1614f0fb2d | |||
5232d6a84f | |||
391602a811 | |||
b4760ac703 | |||
aabb0cded8 | |||
d3a6116a42 | |||
eb81dfc1be | |||
a6e04aa659 | |||
93504a714d | |||
d8a4537efb | |||
28b4077a49 | |||
651430c7a9 | |||
3be9dee1c7 | |||
8ef37a71fb | |||
a30bf83269 | |||
1fdf800988 | |||
82cbad75d4 | |||
6111ca5ff7 | |||
b393996d44 | |||
f12028576c | |||
27d3525469 | |||
8b6fdfed76 | |||
3c427d20c0 | |||
57c003722e | |||
ab4c44a434 | |||
0f7969c999 | |||
aa8f7c48a5 | |||
533925522c | |||
48a6c06ebb | |||
537f2c5033 | |||
f36f9ef6ec | |||
605c191717 | |||
f2615b9ff2 | |||
04174b476c | |||
afac432b2f | |||
2f156edafd | |||
42d551dead | |||
b7d38ef7dd | |||
c5ac8d1ada | |||
2f20216d8f | |||
5e0e120950 | |||
33b701afdc | |||
e0c18374df | |||
20adc9ca13 | |||
dd9855d411 | |||
17e252a436 | |||
dd06f1e1a0 | |||
2ba3060564 | |||
5612874b78 | |||
10af217349 | |||
e65f0dceba | |||
c792a780ee | |||
2d1c1586f5 | |||
5bb3d3b6a8 | |||
b1ec5b8d6f | |||
6e07061deb | |||
97057f259c | |||
e4f6cec536 | |||
e6cf30e7ba | |||
ed8e241007 | |||
c60cb9ab40 | |||
d58ef06907 | |||
462b5685eb | |||
11f7cfe729 | |||
d5ffc04034 | |||
062b7466f6 | |||
e1dbb972f1 | |||
419434020c | |||
2a02ed73e3 | |||
ca378ac734 | |||
67f92de4f0 | |||
c8d4461771 | |||
23b0906cd7 | |||
28a2d8e072 | |||
f97f0b0d11 | |||
05e1dd4c13 | |||
fc78ab7764 | |||
ef8579987f | |||
4dda3b969e | |||
4d2452101a | |||
233cfb5b07 | |||
63b9ec2bd8 | |||
d5a51d4de9 | |||
c7fae1a807 | |||
d6329c26b3 | |||
a96ee88692 | |||
2799a94a9f | |||
5bcbe0d291 | |||
9e7a669d5b | |||
9b084433c3 | |||
fc303dee08 | |||
d75a43c615 | |||
06337e6024 | |||
16b82d066e | |||
074deec781 | |||
2d382b683a | |||
68576f9022 | |||
2df00ecdad | |||
aeb5a6bb63 | |||
2bbf59ddda | |||
dca0545293 | |||
5f99478c76 | |||
48a53f1d24 | |||
11cdfd440b | |||
14cbe9f935 | |||
42d63236f1 | |||
d01d087431 | |||
11c65c4a00 | |||
1b9630e8a1 | |||
3a714339da | |||
65078505c1 | |||
e0b4734dab |
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
|
||||
[{Dockerfile,docker-compose.yml}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
.idea
|
||||
/logs
|
||||
/data
|
||||
.env
|
982
README-zh.md
Normal file
982
README-zh.md
Normal file
@ -0,0 +1,982 @@
|
||||
# LaraDock
|
||||
|
||||
[](http://zalt.me)
|
||||
|
||||
[](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,然后再学习它们。
|
||||
|
||||

|
||||
|
||||
<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.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`)
|
||||
- 所有的都是可视化和可编辑的
|
||||
- 快速的镜像构建
|
||||
- 每周都会有更新...
|
||||
|
||||
<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))
|
||||
|
||||
**主要 贡献者:**
|
||||
|
||||
- [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)
|
588
README.md
588
README.md
@ -2,21 +2,28 @@
|
||||
|
||||
[](http://zalt.me)
|
||||
|
||||
[](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
LaraDock helps you run your **Laravel** App on **Docker** real quick.
|
||||
<br>
|
||||
It's like Laravel Homestead but for Docker instead of Vagrant.
|
||||
|
||||
>With LaraDock, use Docker first and learn about it later.
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||

|
||||
|
||||
<br>
|
||||
## Contents
|
||||
|
||||
|
||||
- [Readme Languages](#)
|
||||
- [English (Default)](#)
|
||||
- [Chinese](https://github.com/LaraDock/laradock/blob/master/README-zh.md)
|
||||
- [Intro](#Intro)
|
||||
- [Features](#features)
|
||||
- [Supported Containers](#Supported-Containers)
|
||||
- [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)
|
||||
@ -41,15 +48,22 @@ 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)
|
||||
- [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version)
|
||||
- [Install xDebug](#Install-xDebug)
|
||||
- [Start/Stop xDebug](#Controll-xDebug)
|
||||
- [Production](#Production)
|
||||
- [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean)
|
||||
- [Misc](#Misc)
|
||||
- [Run a Docker Virtual Host](#Run-Docker-Virtual-Host)
|
||||
- [Find your Docker IP Address](#Find-Docker-IP-Address)
|
||||
- [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)
|
||||
|
||||
|
||||
@ -61,49 +75,66 @@ LaraDock strives to make the development experience easier.
|
||||
It contains pre-packaged Docker Images that provides you a wonderful development environment without requiring you to install PHP, NGINX, MySQL, REDIS, and any other software on your local machine.
|
||||
|
||||
|
||||
**Usage Overview:** Run `NGINX`, `MySQL` and `Redis`.
|
||||
**Usage Overview:**
|
||||
|
||||
Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Redis`. Then run `Laravel`.
|
||||
|
||||
1. Get LaraDock inside your Laravel project:
|
||||
<br>
|
||||
`git clone https://github.com/LaraDock/laradock.git`.
|
||||
2. Enter the laradock folder and run only these Containers:
|
||||
<br>
|
||||
`docker-compose up -d nginx mysql redis`
|
||||
3. Open your `.env` file and set `DB_HOST` to `mysql` and `REDIS_HOST` to `redis`.
|
||||
4. Open your browser and visit the localhost: `http://localdock`
|
||||
|
||||
|
||||
```shell
|
||||
docker-compose up nginx mysql redis
|
||||
```
|
||||
|
||||
<a name="features"></a>
|
||||
### Features
|
||||
|
||||
- Easy switch between PHP versions: 7.0 - 5.6 - 5.5 ...
|
||||
- Choose your favorite database engine: MySQL - Postgres - Redis ...
|
||||
- Run your own combination of software's: Memcached - MariaDB ...
|
||||
- Every software runs on a separate container: PHP-FPM - NGINX ...
|
||||
- Easy switch between PHP versions: 7.0, 5.6, 5.5...
|
||||
- Choose your favorite database engine: MySQL, Postgres, MariaDB...
|
||||
- Run your own combination of software's: Memcached, HHVM, Beanstalkd...
|
||||
- Every software runs on a separate container: PHP-FPM, NGINX, PHP-CLI...
|
||||
- Easy to customize any container, with simple edit to the `dockerfile`.
|
||||
- All Images extends from an official base Image. (Trusted base Images).
|
||||
- Pre-configured Nginx for Laravel.
|
||||
- Data container, to keep Data safe and accessible.
|
||||
- Easy to apply configurations inside containers.
|
||||
- Clean and well structured Dockerfiles (`dockerfile`).
|
||||
- Latest version of the Docker Compose file (`docker-compose`).
|
||||
- Everything is visible and editable.
|
||||
- Fast Images Builds.
|
||||
- More to come every week..
|
||||
|
||||
|
||||
<a name="Supported-Containers"></a>
|
||||
### Supported Containers
|
||||
### Supported Software's (Containers)
|
||||
|
||||
- PHP-FPM (7.0 - 5.6 - 5.5)
|
||||
- NGINX
|
||||
- MySQL
|
||||
- PostgreSQL
|
||||
- MariaDB
|
||||
- Neo4j
|
||||
- MongoDB
|
||||
- Redis
|
||||
- Memcached
|
||||
- Beanstalkd
|
||||
- Beanstalkd Console
|
||||
- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano and cURL)
|
||||
- Data *(Databases Data Container)*
|
||||
- Application *(Application Code Container)*
|
||||
- **Database Engines:**
|
||||
- MySQL
|
||||
- PostgreSQL
|
||||
- MariaDB
|
||||
- MongoDB
|
||||
- Neo4j
|
||||
- **Cache Engines:**
|
||||
- Redis
|
||||
- Memcached
|
||||
- **PHP Servers:**
|
||||
- NGINX
|
||||
- Apache2
|
||||
- Caddy
|
||||
- **PHP Compilers:**
|
||||
- PHP-FPM
|
||||
- HHVM
|
||||
- **Message Queueing Systems:**
|
||||
- Beanstalkd (+ Beanstalkd Console)
|
||||
- **Tools:**
|
||||
- Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...)
|
||||
- phpMyAdmin
|
||||
|
||||
|
||||
>If you can't find your container, 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 :)
|
||||
|
||||
|
||||
|
||||
@ -127,7 +158,7 @@ Seriously!!!
|
||||
|
||||
Instead of providing a full Virtual Machines, like you get with Vagrant, Docker provides you **lightweight** Virtual Containers, that share the same kernel and allow to safely execute independent processes.
|
||||
|
||||
In addition to the speed, Docker gives tens of features that cannot be achieved with Vagrant.
|
||||
In addition to the speed, Docker gives tons of features that cannot be achieved with Vagrant.
|
||||
|
||||
Most importantly Docker can run on Development and on Production (same environment everywhere). While Vagrant is designed for Development only, (so you have to re-provision your server on Production every time).
|
||||
|
||||
@ -139,22 +170,9 @@ LaraDock and [Homestead](https://laravel.com/docs/master/homestead) both gives y
|
||||
|
||||
- Homestead is a tool that controls Vagrant for you (using Homestead special commands). And Vagrant manages your Virtual Machine.
|
||||
|
||||
- LaraDock is a tool that controls Docker for you (using Docker Compose official commands). And Docker manages you Virtual Containers.
|
||||
- LaraDock is a tool that controls Docker for you (using Docker & Docker Compose official commands). And Docker manages your Virtual Containers.
|
||||
|
||||
Running a virtual Container is much faster than running a full virtual Machine.
|
||||
<br>Thus **LaraDock is much faster than Homestead**.
|
||||
|
||||
|
||||
|
||||
<a name="Requirements"></a>
|
||||
## Requirements
|
||||
|
||||
| Linux | Windows & MAC |
|
||||
|-----------------------------------------------------------------------------------------|---------------------------------------------------------|
|
||||
| [Laravel](https://laravel.com/docs/master/installation) | [Laravel](https://laravel.com/docs/master/installation) |
|
||||
| [Git](https://git-scm.com/downloads) | [Git](https://git-scm.com/downloads) |
|
||||
| [Docker Engine](https://docs.docker.com/engine/installation/linux/ubuntulinux) | [Docker Toolbox](https://www.docker.com/toolbox) |
|
||||
| [Docker Compose](https://docs.docker.com/compose/install) | |
|
||||
Running a virtual Container is much faster than running a full virtual Machine. Thus **LaraDock is much faster than Homestead**.
|
||||
|
||||
|
||||
|
||||
@ -163,15 +181,30 @@ Running a virtual Container is much faster than running a full virtual Machine.
|
||||
<a name="Demo"></a>
|
||||
## Demo Video
|
||||
|
||||
What's better than a [**Demo Video**](https://www.youtube.com/watch?v=-DamFMczwDA) :)
|
||||
What's better than a **Demo Video**:
|
||||
|
||||
- LaraDock v4.0 (Coming soon..)
|
||||
- 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>
|
||||
## Requirements
|
||||
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
- [Docker](https://www.docker.com/products/docker/) `>= 1.12`
|
||||
|
||||
|
||||
|
||||
<a name="Installation"></a>
|
||||
## Installation
|
||||
|
||||
|
||||
1 - Clone the `LaraDock` repository.
|
||||
1 - Clone the `LaraDock` repository:
|
||||
|
||||
**A)** If you already have a Laravel project, clone this repository on your `Laravel` root direcotry:
|
||||
**A)** If you already have a Laravel project, clone this repository on your `Laravel` root directory:
|
||||
|
||||
```bash
|
||||
git submodule add https://github.com/LaraDock/laradock.git
|
||||
@ -190,13 +223,21 @@ git clone https://github.com/LaraDock/laradock.git
|
||||
## Usage
|
||||
|
||||
|
||||
1 - For **Windows & MAC** users only: If you are not using the native Docker-Engine `Beta`, make sure you have a running Docker Virtual Host on your machine.
|
||||
[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host)
|
||||
(**Linux** users don't need a Virtual Host, so skip this step).
|
||||
**Read Before starting:**
|
||||
|
||||
If you are using **Docker Toolbox** (VM), do one of the following:
|
||||
|
||||
- Upgrade to Docker [Native](https://www.docker.com/products/docker) for Mac/Windows (Recommended). Check out [Upgrading Laradock](#upgrading-laradock)
|
||||
- Use LaraDock v3.* (Visit the `LaraDock-ToolBox` [Branch](https://github.com/LaraDock/laradock/tree/LaraDock-ToolBox)).
|
||||
|
||||
|
||||
If you are using **Docker Native** (For Mac/Windows) or even for Linux, continue this documentation normally since LaraDock v4 and above is just for that.
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
2 - Run some Containers: *(Make sure you are in the `laradock` folder before running the `docker-compose` commands).*
|
||||
<br>
|
||||
1 - Run Containers: *(Make sure you are in the `laradock` folder before running the `docker-compose` commands).*
|
||||
|
||||
|
||||
|
||||
@ -206,46 +247,43 @@ git clone https://github.com/LaraDock/laradock.git
|
||||
docker-compose up -d nginx mysql
|
||||
```
|
||||
|
||||
You can select your own combination of container form this list:
|
||||
You can select your own combination of Containers form the list below:
|
||||
|
||||
`nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`, `data`, `php-fpm`, `application`.
|
||||
|
||||
|
||||
**Note**: `workspace`, `data`, `php-fpm` and `application` will run automatically in most of the cases.
|
||||
`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `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.
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...).
|
||||
2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...).
|
||||
|
||||
```bash
|
||||
docker exec -it {Workspace-Container-Name} bash
|
||||
docker-compose exec workspace bash
|
||||
```
|
||||
Replace `{Workspace-Container-Name}` with your Workspace container name.
|
||||
<br>
|
||||
To find the containers names type `docker-compose ps`.
|
||||
<br />
|
||||
Add `--user=laradock` (example `docker-compose exec --user=laradock workspace bash`) to have files created as your host's user. (you can change the PUID (User id) and PGID (group id) variables from the `docker-compose.yml`).
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
4 - Edit the Laravel configurations.
|
||||
3 - Edit the Laravel configurations.
|
||||
|
||||
If you don't have a Laravel project installed yet, see [How to Install Laravel in a Docker Container](#Install-Laravel).
|
||||
|
||||
Open your Laravel's `.env` file and set the `DB_HOST` to your `{Docker-IP}`:
|
||||
Open your Laravel's `.env` file and set the `DB_HOST` to your `mysql`:
|
||||
|
||||
```env
|
||||
DB_HOST=xxx.xxx.xxx.xxx
|
||||
DB_HOST=mysql
|
||||
```
|
||||
[How to find my Docker IP Address?](#Find-Docker-IP-Address)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
5 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
|
||||
4 - Open your browser and visit your localhost address (`http://localhost/`).
|
||||
|
||||
|
||||
|
||||
@ -260,9 +298,8 @@ If you need a special support. Contact me, more details in the [Help & Questions
|
||||
## Documentation
|
||||
|
||||
|
||||
|
||||
<a name="Docker"></a>
|
||||
### [Docker]
|
||||
|
||||
|
||||
|
||||
|
||||
@ -323,8 +360,15 @@ docker-compose down
|
||||
2 - enter any container using:
|
||||
|
||||
```bash
|
||||
docker exec -it {container-name} bash
|
||||
docker-compose exec {container-name} bash
|
||||
```
|
||||
|
||||
*Example: enter MySQL container*
|
||||
|
||||
```bash
|
||||
docker-compose exec mysql bash
|
||||
```
|
||||
|
||||
3 - to exit a container, type `exit`.
|
||||
|
||||
|
||||
@ -376,10 +420,7 @@ example for `mysql` it will be `mysql/Dockerfile`.
|
||||
```bash
|
||||
docker-compose build mysql
|
||||
```
|
||||
|
||||
*If you find any bug or you have and suggestion that can improve the performance of any image, please consider contributing. Thanks in advance.*
|
||||
|
||||
|
||||
More info on Containers rebuilding [here](#Build-Re-build-Containers).
|
||||
|
||||
|
||||
|
||||
@ -403,6 +444,7 @@ Optionally you can specify which container to rebuild (instead of rebuilding all
|
||||
docker-compose build {container-name}
|
||||
```
|
||||
|
||||
You might use the `--no-cache` option if you want full rebuilding (`docker-compose build --no-cache {container-name}`).
|
||||
|
||||
|
||||
|
||||
@ -439,7 +481,6 @@ docker logs {container-name}
|
||||
|
||||
<br>
|
||||
<a name="Laravel"></a>
|
||||
### [Laravel]
|
||||
|
||||
|
||||
|
||||
@ -457,7 +498,7 @@ Example using Composer
|
||||
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).
|
||||
|
||||
@ -480,6 +521,8 @@ Since the new Laravel application is in the `my-cool-app` folder, we need to rep
|
||||
cd my-cool-app
|
||||
```
|
||||
|
||||
5 - Go back to the laraDock installation steps to see how to edit the `.env` file.
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
@ -503,9 +546,12 @@ docker-compose ps
|
||||
3 - Enter the Workspace container:
|
||||
|
||||
```bash
|
||||
docker exec -it {workspace-container-name} bash
|
||||
docker-compose exec workspace bash
|
||||
```
|
||||
|
||||
Add `--user=laradock` (example `docker-compose exec --user=laradock workspace bash`) to have files created as your host's user.
|
||||
|
||||
|
||||
4 - Run anything you want :)
|
||||
|
||||
```bash
|
||||
@ -528,19 +574,19 @@ phpunit
|
||||
docker-compose up -d redis
|
||||
```
|
||||
|
||||
2 - Open your Laravel's `.env` file and set the `REDIS_HOST` to your `Docker-IP` instead of the default `127.0.0.1` IP.
|
||||
2 - Open your Laravel's `.env` file and set the `REDIS_HOST` to `redis`
|
||||
|
||||
```env
|
||||
REDIS_HOST=xxx.xxx.xxx.xxx
|
||||
REDIS_HOST=redis
|
||||
```
|
||||
|
||||
If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the default `127.0.0.1` IP with your `Docker-IP` for Redis like this:
|
||||
If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the default `127.0.0.1` IP with `redis` for Redis like this:
|
||||
|
||||
```php
|
||||
'redis' => [
|
||||
'cluster' => false,
|
||||
'default' => [
|
||||
'host' => 'xxx.xxx.xxx.xxx',
|
||||
'host' => 'redis',
|
||||
'port' => 6379,
|
||||
'database' => 0,
|
||||
],
|
||||
@ -574,14 +620,47 @@ composer require predis/predis:^1.0
|
||||
<a name="Use-Mongo"></a>
|
||||
### Use Mongo
|
||||
|
||||
1 - First make sure you run the MongoDB Container (`mongo`) with the `docker-compose up` command.
|
||||
1 - First install `mongo` in the Workspace and the PHP-FPM Containers:
|
||||
<br>
|
||||
a) open the `docker-compose.yml` file
|
||||
<br>
|
||||
b) search for the `INSTALL_MONGO` argument under the Workspace Container
|
||||
<br>
|
||||
c) set it to `true`
|
||||
<br>
|
||||
d) search for the `INSTALL_MONGO` argument under the PHP-FPM Container
|
||||
<br>
|
||||
e) set it to `true`
|
||||
|
||||
It should be like this:
|
||||
|
||||
```yml
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_MONGO=true
|
||||
...
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
args:
|
||||
- INSTALL_MONGO=true
|
||||
...
|
||||
```
|
||||
|
||||
2 - Re-build the containers `docker-compose build workspace php-fpm`
|
||||
|
||||
|
||||
|
||||
3 - Run the MongoDB Container (`mongo`) with the `docker-compose up` command.
|
||||
|
||||
```bash
|
||||
docker-compose up -d mongo
|
||||
```
|
||||
|
||||
|
||||
2 - Add the MongoDB configurations to the `config/database.php` config file:
|
||||
4 - Add the MongoDB configurations to the `config/database.php` config file:
|
||||
|
||||
```php
|
||||
'connections' => [
|
||||
@ -603,24 +682,24 @@ docker-compose up -d mongo
|
||||
],
|
||||
```
|
||||
|
||||
3 - Open your Laravel's `.env` file and update the following variables:
|
||||
5 - Open your Laravel's `.env` file and update the following variables:
|
||||
|
||||
- set the `DB_HOST` to your `Docker-IP`.
|
||||
- set the `DB_HOST` to your `mongo`.
|
||||
- set the `DB_PORT` to `27017`.
|
||||
- set the `DB_DATABASE` to `database`.
|
||||
|
||||
|
||||
4 - Finally make sure you have the `jenssegers/mongodb` package installed via Composer and its Service Provider is added.
|
||||
6 - Finally make sure you have the `jenssegers/mongodb` package installed via Composer and its Service Provider is added.
|
||||
|
||||
```bash
|
||||
composer require jenssegers/mongodb
|
||||
```
|
||||
More details about this [here](https://github.com/jenssegers/laravel-mongodb#installation).
|
||||
|
||||
5 - Test it:
|
||||
7 - Test it:
|
||||
|
||||
- First let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent).
|
||||
- Enter the Workspace Container `docker exec -it laradock_workspace_1 bash`.
|
||||
- Enter the Workspace Container.
|
||||
- Migrate the Database `php artisan migrate`.
|
||||
|
||||
|
||||
@ -628,9 +707,28 @@ 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>
|
||||
<a name="PHP"></a>
|
||||
### [PHP]
|
||||
|
||||
|
||||
|
||||
@ -656,20 +754,18 @@ The PHP-CLI extensions should be installed in `workspace/Dockerfile`.
|
||||
|
||||
<br>
|
||||
<a name="Change-the-PHP-FPM-Version"></a>
|
||||
### Change the PHP-FPM Version
|
||||
### Change the (PHP-FPM) Version
|
||||
By default **PHP-FPM 7.0** is running.
|
||||
|
||||
>The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planing to run your application on different PHP-FPM version.
|
||||
|
||||
#### A) Switch from PHP `7.0` to PHP `5.6`
|
||||
|
||||
1 - Open the `docker-compose.yml`.
|
||||
|
||||
2 - Search for `Dockerfile-70` in the PHP container section.
|
||||
|
||||
3 - Change the version number.
|
||||
<br>
|
||||
Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`.
|
||||
|
||||
Sample:
|
||||
3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-56`, like this:
|
||||
|
||||
```txt
|
||||
php-fpm:
|
||||
@ -678,20 +774,33 @@ php-fpm:
|
||||
dockerfile: Dockerfile-70
|
||||
```
|
||||
|
||||
Supported Versions:
|
||||
|
||||
- For (PHP 7.0.*) use `Dockerfile-70`
|
||||
- For (PHP 5.6.*) use `Dockerfile-56`
|
||||
- For (PHP 5.5.*) use `Dockerfile-55`
|
||||
|
||||
|
||||
4 - Finally rebuild the container
|
||||
|
||||
```bash
|
||||
docker-compose build php
|
||||
```
|
||||
|
||||
For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
|
||||
> For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
|
||||
|
||||
|
||||
#### B) Switch from PHP `7.0` or `5.6` to PHP `5.5`
|
||||
|
||||
We do not natively support PHP 5.5 anymore, but you can get it in few steps:
|
||||
|
||||
1 - Clone `https://github.com/LaraDock/php-fpm`.
|
||||
|
||||
3 - Rename `Dockerfile-56` to `Dockerfile-55`.
|
||||
|
||||
3 - Edit the file `FROM php:5.6-fpm` to `FROM php:5.5-fpm`.
|
||||
|
||||
4 - Build an image from `Dockerfile-55`.
|
||||
|
||||
5 - Open the `docker-compose.yml` file.
|
||||
|
||||
6 - Point `php-fpm` to your `Dockerfile-55` file.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -715,104 +824,95 @@ Right now you have to manually edit the `Dockerfile` or create a new one like it
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Install-xDebug"></a>
|
||||
### Install xDebug
|
||||
|
||||
1 - First install `xDebug` in the Workspace and the PHP-FPM Containers:
|
||||
<br>
|
||||
a) open the `docker-compose.yml` file
|
||||
<br>
|
||||
b) search for the `INSTALL_XDEBUG` argument under the Workspace Container
|
||||
<br>
|
||||
c) set it to `true`
|
||||
<br>
|
||||
d) search for the `INSTALL_XDEBUG` argument under the PHP-FPM Container
|
||||
<br>
|
||||
e) set it to `true`
|
||||
|
||||
It should be like this:
|
||||
|
||||
```yml
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
...
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
...
|
||||
```
|
||||
|
||||
2 - Re-build the containers `docker-compose build workspace php-fpm`
|
||||
|
||||
|
||||
For information on how to configure xDebug with your IDE and work it out, check this [Repository](https://github.com/LarryEitel/laravel-laradock-phpstorm).
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Controll-xDebug"></a>
|
||||
### Start/Stop xDebug:
|
||||
|
||||
By installing xDebug, you are enabling it to run on startup by default.
|
||||
|
||||
To controll the behavior of xDebug (in the `php-fpm` Container), you can run the following commands from the LaraDock root folder:
|
||||
|
||||
- Stop xDebug from running by default: `./xdebugPhpFpm stop`.
|
||||
- Start xDebug by default: `./xdebugPhpFpm start`.
|
||||
- See the status: `./xdebugPhpFpm status`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Production"></a>
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Digital-Ocean"></a>
|
||||
### Setup Laravel and Docker on Digital Ocean
|
||||
|
||||
####[Full Giude Here](https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md)
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Misc"></a>
|
||||
### [Misc]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="Run-Docker-Virtual-Host"></a>
|
||||
### Run a Docker Virtual Host
|
||||
|
||||
These steps are only for **Windows & MAC** users *(Linux users don't need a virtual host)*:
|
||||
|
||||
1 - Run the default Host:
|
||||
|
||||
```bash
|
||||
docker-machine start default
|
||||
```
|
||||
|
||||
* If the host "default" does not exist, create one using the command below, else skip it:
|
||||
|
||||
* ```bash
|
||||
docker-machine create -d virtualbox default
|
||||
```
|
||||
|
||||
2 - Run this command to configure your shell:
|
||||
|
||||
```bash
|
||||
eval $(docker-machine env)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Find-Docker-IP-Address"></a>
|
||||
### Find your Docker IP Address
|
||||
|
||||
**On Windows & MAC:**
|
||||
|
||||
Run this command in your terminal:
|
||||
|
||||
```bash
|
||||
docker-machine ip default
|
||||
```
|
||||
If your Host name is different then `default`, you have to specify it (`docker-machine ip my-host`).
|
||||
|
||||
*(The default IP is 192.168.99.100)*
|
||||
|
||||
<br>
|
||||
|
||||
> **boot2docker** users: run `boot2docker ip` *(when boot2docker is up)*.
|
||||
|
||||
<br>
|
||||
**On Linux:**
|
||||
|
||||
Run this command in your terminal:
|
||||
|
||||
```shell
|
||||
ifconfig docker0 | grep 'inet' | cut -d: -f2 | awk '{ print $1}' | head -n1
|
||||
```
|
||||
|
||||
*(The default IP is 172.17.0.1)*
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Use-custom-Domain"></a>
|
||||
### Use custom Domain (instead of the Docker IP)
|
||||
|
||||
Assuming your custom domain is `laravel.dev` and your current `Docker-IP` is `xxx.xxx.xxx.xxx`.
|
||||
Assuming your custom domain is `laravel.dev`
|
||||
|
||||
1 - Open your `/etc/hosts` file and map your `Docker IP` to the `laravel.dev` domain, by adding the following:
|
||||
1 - Open your `/etc/hosts` file and map your localhost address `127.0.0.1` to the `laravel.dev` domain, by adding the following:
|
||||
|
||||
```bash
|
||||
xxx.xxx.xxx.xxx laravel.dev
|
||||
127.0.0.1 laravel.dev
|
||||
```
|
||||
|
||||
2 - Open your Laravel's `.env` file and replace the `127.0.0.1` default values with your `{Docker-IP}`.
|
||||
<br>
|
||||
Example:
|
||||
|
||||
```env
|
||||
DB_HOST=xxx.xxx.xxx.xxx
|
||||
```
|
||||
|
||||
3 - Open your browser and visit `{http://laravel.dev}`
|
||||
|
||||
2 - Open your browser and visit `{http://laravel.dev}`
|
||||
|
||||
|
||||
Optionally you can define the server name in the nginx config file, like this:
|
||||
@ -822,29 +922,126 @@ server_name laravel.dev;
|
||||
```
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Enable-Global-Composer-Build-Install"></a>
|
||||
### Enable Global Composer Build Install
|
||||
|
||||
Enabling Global Composer Install during the build for the container allows you to get your composer requirements installed and available in the container after the build is done.
|
||||
|
||||
1 - open the `docker-compose.yml` file
|
||||
|
||||
2 - search for the `COMPOSER_GLOBAL_INSTALL` argument under the Workspace Container and set it to `true`
|
||||
|
||||
It should be like this:
|
||||
|
||||
```yml
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- COMPOSER_GLOBAL_INSTALL=true
|
||||
...
|
||||
```
|
||||
3 - now add your dependencies to `workspace/composer.json`
|
||||
|
||||
4 - rebuild the Workspace Container `docker-compose build workspace`
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Install-Prestissimo"></a>
|
||||
### Install Prestissimo
|
||||
|
||||
[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality.
|
||||
|
||||
1 - Enable Running Global Composer Install during the Build:
|
||||
|
||||
Click on this [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) and do steps 1 and 2 only then continue here.
|
||||
|
||||
2 - Add prestissimo as requirement in Composer:
|
||||
|
||||
a - now open the `workspace/composer.json` file
|
||||
|
||||
b - add `"hirak/prestissimo": "^0.3"` as requirement
|
||||
|
||||
c - rebuild the Workspace Container `docker-compose build workspace`
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Install-Node"></a>
|
||||
### Install Node + NVM
|
||||
|
||||
To install NVM and NodeJS in the Workspace container
|
||||
|
||||
1 - Open the `docker-compose.yml` file
|
||||
|
||||
2 - Search for the `INSTALL_NODE` argument under the Workspace Container and set it to `true`
|
||||
|
||||
It should be like this:
|
||||
|
||||
```yml
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_NODE=true
|
||||
...
|
||||
```
|
||||
|
||||
3 - Re-build the container `docker-compose build workspace`
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="debugging"></a>
|
||||
### Debugging
|
||||
|
||||
*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 this command from the Laravel root directory:
|
||||
Run the following command from the Laravel root directory:
|
||||
|
||||
```bash
|
||||
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`
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="upgrading-laradock"></a>
|
||||
### Upgrading LaraDock
|
||||
|
||||
|
||||
Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requires upgrading LaraDock from v3.* to v4.*:
|
||||
|
||||
1. Stop the docker vm `docker-machine stop {default}`
|
||||
2. Install Docker for [Mac](https://docs.docker.com/docker-for-mac/) or [Windows](https://docs.docker.com/docker-for-windows/).
|
||||
3. Upgrade LaraDock to `v4.*.*` (`git pull origin master`)
|
||||
4. Use LaraDock as you used to do: `docker-compose up -d nginx mysql`.
|
||||
|
||||
**Note:** If you face any problem with the last step above: rebuild all your containers
|
||||
`docker-compose build --no-cache`
|
||||
"Warnning Containers Data might be lost!"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -853,16 +1050,16 @@ use `http://127.0.0.1` instead of `http://localhost` in your browser.
|
||||
|
||||
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)
|
||||
|
||||
<a name="Help"></a>
|
||||
## Help & Questions
|
||||
|
||||
If you need any help with Docker and Laravel, you can schedule a live call with the creator of this project at [Codementor.io](https://www.codementor.io/mahmoudz), He would love to help.
|
||||
Join the chat room on [Gitter](https://gitter.im/LaraDock/laradock) and get help and support from the community.
|
||||
|
||||
For general questions you can open [Issues](https://github.com/laradock/laradock/issues) here on Github (We will label them as questions).
|
||||
|
||||
Additionally, you can contact Mahmoud Zalt (the creator of this project) via a direct message on LaraChat, (his username is `mahmoud_zalt`). Or send him an email (`mahmoud@zalt.me`).
|
||||
You can as well can open an [issue](https://github.com/laradock/laradock/issues) on Github (will be labeled as Question) and discuss it with people on [Gitter](https://gitter.im/LaraDock/laradock).
|
||||
|
||||
For special help with Docker and/or Laravel, you can schedule a live call with the creator of this project at [Codementor.io](https://www.codementor.io/mahmoudz).
|
||||
|
||||
## Credits
|
||||
|
||||
@ -872,9 +1069,20 @@ Additionally, you can contact Mahmoud Zalt (the creator of this project) via a d
|
||||
|
||||
**Main Contributors:**
|
||||
|
||||
- [Bo-Yi Wu](https://github.com/appleboy)
|
||||
- [Amin Mkh](https://github.com/AminMkh)
|
||||
- [Matthew Tonkin Dunn](https://github.com/mattythebatty)
|
||||
- [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)
|
||||
- [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)
|
||||
|
||||
**Awesome People:**
|
||||
|
140
_guides/contributing.md
Normal file
140
_guides/contributing.md
Normal file
@ -0,0 +1,140 @@
|
||||
# Contributing to LaraDock
|
||||
|
||||
Your contribution is more than welcome. Let's keep LaraDock amazing.
|
||||
|
||||
|
||||
### Got a Question or Problem?
|
||||
|
||||
If you have questions about how to use LaraDock, please direct your questions to the discussion on [Gitter](https://gitter.im/LaraDock/laradock). If you beleave your question could help others, then consider opening an [Issue](https://github.com/laradock/laradock/issues) (it will be labeled as Question).
|
||||
|
||||
### Found an Issue?
|
||||
If you find a bug in the source code or a mistake in the documentation, you can help us by
|
||||
submitting an [Issue](https://github.com/laradock/laradock/issues). Even better you can submit a Pull Request with a fix.
|
||||
|
||||
### Want a Feature?
|
||||
You can request a new feature by submitting an [Issue](https://github.com/laradock/laradock/issues) (it will be labeled as Feature Suggestion). If you would like to implement a new feature then consider submitting a Pull Request.
|
||||
|
||||
|
||||
## Coding Guidelines
|
||||
|
||||
### Support new Software
|
||||
|
||||
* Create folder with the software name.
|
||||
|
||||
* Add a `Dockerfile`, write your code there.
|
||||
|
||||
* You may add additional files in the software folder.
|
||||
|
||||
* Add the software to the `docker-compose.yml` file.
|
||||
|
||||
* Make sure you follow our commenting style.
|
||||
|
||||
* Add the software in the `Readme`.
|
||||
|
||||
### Edit existing Software
|
||||
|
||||
* Open the software (container) folder.
|
||||
|
||||
* Edit the files you want to update.
|
||||
|
||||
* **Note:** If you want to edit the base image of the `Workspace` or the `php-fpm` Containers,
|
||||
you need to edit their Dockerfiles from their Github repositories. For more info read their Dockerfiles comment on the LaraDock repository.
|
||||
|
||||
* Make sure to update the `Readme` incase you made any changes.
|
||||
|
||||
## Issue/PR Submission Guidelines
|
||||
|
||||
### Submitting an Issue
|
||||
Before you submit your issue search the archive, maybe your question was already answered.
|
||||
|
||||
If your issue appears to be a bug, and hasn't been reported, open a new issue.
|
||||
Help us to maximize the effort we can spend fixing issues and adding new
|
||||
features, by not reporting duplicate issues.
|
||||
|
||||
|
||||
### Before Submitting a Pull Request (PR)
|
||||
|
||||
Always Test everything and make sure its working:
|
||||
|
||||
- Pull the latest updates (or fork of you don’t have permission)
|
||||
- Before editing anything:
|
||||
- Test building the container (docker-compose build --no-cache container-name) build with no cache first.
|
||||
- Test running the container with some other containers in real app and see of everything is working fine.
|
||||
- Now edit the container (edit section by section and test rebuilding the container after every edited section)
|
||||
- Testing building the container (docker-compose build container-name) with no errors.
|
||||
- Test it in real App.
|
||||
|
||||
|
||||
### Submitting a PR
|
||||
Consider the following guidelines:
|
||||
|
||||
* Search [GitHub](https://github.com/LaraDock/laradock/pulls) for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort.
|
||||
|
||||
* Make your changes in a new git branch:
|
||||
|
||||
```shell
|
||||
git checkout -b my-fix-branch master
|
||||
```
|
||||
* Commit your changes using a descriptive commit message.
|
||||
|
||||
* Push your branch to GitHub:
|
||||
|
||||
```shell
|
||||
git push origin my-fix-branch
|
||||
```
|
||||
|
||||
* In GitHub, send a pull request to `laradock:master`.
|
||||
* If we suggest changes then:
|
||||
* Make the required updates.
|
||||
* Commit your changes to your branch (e.g. `my-fix-branch`).
|
||||
* Push the changes to your GitHub repository (this will update your Pull Request).
|
||||
|
||||
> If the PR gets too outdated we may ask you to rebase and force push to update the PR:
|
||||
|
||||
```shell
|
||||
git rebase master -i
|
||||
git push origin my-fix-branch -f
|
||||
```
|
||||
|
||||
*WARNING. Squashing or reverting commits and forced push thereafter may remove GitHub comments on code that were previously made by you and others in your commits.*
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### After your PR is merged
|
||||
|
||||
After your pull request is merged, you can safely delete your branch and pull the changes
|
||||
from the main (upstream) repository:
|
||||
|
||||
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
|
||||
|
||||
```shell
|
||||
git push origin --delete my-fix-branch
|
||||
```
|
||||
|
||||
* Check out the master branch:
|
||||
|
||||
```shell
|
||||
git checkout master -f
|
||||
```
|
||||
|
||||
* Delete the local branch:
|
||||
|
||||
```shell
|
||||
git branch -D my-fix-branch
|
||||
```
|
||||
|
||||
* Update your master with the latest upstream version:
|
||||
|
||||
```shell
|
||||
git pull --ff upstream master
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
### Happy Coding :)
|
213
_guides/digital_ocean.md
Normal file
213
_guides/digital_ocean.md
Normal file
@ -0,0 +1,213 @@
|
||||
#### Install Docker
|
||||
```
|
||||
Login Digital Ocean
|
||||
Add Droplet
|
||||
1 Click Install docker
|
||||
Choose Droplet
|
||||
reset ROOT password
|
||||
check email
|
||||
```
|
||||
|
||||
#### SSH to your Server
|
||||
|
||||
```
|
||||
ssh root@ipaddress
|
||||
```
|
||||
you will be prompt of that password.
|
||||
type the password you receive in your email
|
||||
|
||||
then it will ask to you to change a new password
|
||||
just change it to the custom root password you want
|
||||
|
||||
After SSH
|
||||
you can check that docker command is working by typing
|
||||
|
||||
```
|
||||
$root@midascode:~# docker
|
||||
```
|
||||
|
||||
#### Set Up Your Laravel Project
|
||||
|
||||
```
|
||||
$root@midascode:~# apt-get install git
|
||||
$root@midascode:~# git clone https://github.com/laravel/laravel
|
||||
$root@midascode:~# cd laravel
|
||||
$root@midascode:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
|
||||
$root@midascode:~/laravel/ cd laradock
|
||||
```
|
||||
|
||||
#### Install docker-compose command
|
||||
|
||||
```
|
||||
$root@midascode:~/laravel/laradock# curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh > /usr/local/bin/docker-compose
|
||||
$root@midascode:~/chmod +x /usr/local/bin/docker-compose
|
||||
```
|
||||
|
||||
#### Create Your LaraDock Containers
|
||||
|
||||
```
|
||||
$root@midascode:~/laravel/laradock# docker-compose up -d nginx mysql
|
||||
```
|
||||
|
||||
#### Go to Your Workspace
|
||||
|
||||
```
|
||||
docker-compose exec workspace bash
|
||||
```
|
||||
|
||||
#### Install laravel Dependencies, Add .env , generate Key and give proper permission certain folder
|
||||
|
||||
```
|
||||
$ root@0e77851d27d3:/var/www/laravel# composer install
|
||||
$ root@0e77851d27d3:/var/www/laravel# cp .env.example .env
|
||||
$ root@0e77851d27d3:/var/www/laravel# php artisan key:generate
|
||||
$ root@0e77851d27d3:/var/www/laravel# exit
|
||||
$root@midascode:~/laravel/laradock# cd ..
|
||||
$root@midascode:~/laravel# sudo chmod -R 777 storage bootstrap/cache
|
||||
```
|
||||
|
||||
you can then view your laravel site at your ipaddress
|
||||
for example
|
||||
```
|
||||
192.168.1.1
|
||||
```
|
||||
|
||||
You will see there Laravel Default Welcome Page
|
||||
|
||||
but if you need to view on your custom domain name
|
||||
which you would.
|
||||
|
||||
#### Using Your Own Domain Name
|
||||
login to your DNS provider
|
||||
Godaddy, Namecheap what ever...
|
||||
And Point the Custom Domain Name Server to
|
||||
|
||||
```
|
||||
ns1.digitalocean.com
|
||||
ns2.digitalocean.com
|
||||
ns3.digitalocean.com
|
||||
```
|
||||
In Your Digital Ocean Account go to
|
||||
```
|
||||
https://cloud.digitalocean.com/networking/domains
|
||||
```
|
||||
add your domain name and choose the server ip you provision earlier
|
||||
|
||||
#### Serve Site With NGINX (HTTP ONLY)
|
||||
Go back to command line
|
||||
```
|
||||
$root@midascode:~/laravel/laradock# cd nginx
|
||||
$root@midascode:~/laravel/laradock/nginx# vim laravel.conf
|
||||
```
|
||||
remove default_server
|
||||
```
|
||||
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
|
||||
```
|
||||
and add server_name (your custom domain)
|
||||
```
|
||||
listen 80;
|
||||
listen [::]:80 ipv6only=on;
|
||||
server_name yourdomain.com;
|
||||
```
|
||||
|
||||
#### Rebuild Your Nginx
|
||||
```
|
||||
$root@midascode:~/laravel/laradock/nginx# docker-compose down
|
||||
$root@midascode:~/laravel/laradock/nginx# docker-compose build nginx
|
||||
```
|
||||
|
||||
#### Re Run Your Containers MYSQL and NGINX
|
||||
```
|
||||
$root@midascode:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
||||
```
|
||||
|
||||
###### View Your Site with HTTP ONLY (http://yourdomain.com)
|
||||
|
||||
#### Run Site on SSL with Let's Encrypt Certificate
|
||||
|
||||
###### Note: You need to Use Caddy here Instead of Nginx
|
||||
|
||||
###### To go Caddy Folders and Edit CaddyFile
|
||||
|
||||
```
|
||||
$root@midascode:~/laravel/laradock# cd caddy
|
||||
$root@midascode:~/laravel/laradock/caddy# vim Caddyfile
|
||||
```
|
||||
|
||||
Remove 0.0.0.0:80
|
||||
|
||||
```
|
||||
0.0.0.0:80
|
||||
root /var/www/laravel/public
|
||||
```
|
||||
and replace with your https://yourdomain.com
|
||||
|
||||
```
|
||||
https://yourdomain.com
|
||||
root /var/www/laravel/public
|
||||
```
|
||||
uncomment tls
|
||||
|
||||
```
|
||||
#tls self-signed
|
||||
```
|
||||
and replace self-signed with your email address
|
||||
|
||||
```
|
||||
tls midascodebreaker@gmai.com
|
||||
```
|
||||
This is needed Prior to Creating Let's Encypt
|
||||
|
||||
#### Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
|
||||
|
||||
```
|
||||
$root@midascode:~/laravel/laradock/caddy# docker-compose up caddy
|
||||
```
|
||||
|
||||
you will be prompt here to enter your email... you may enter it or not
|
||||
```
|
||||
Attaching to laradock_mysql_1, laradock_caddy_1
|
||||
caddy_1 | Activating privacy features...
|
||||
caddy_1 | Your sites will be served over HTTPS automatically using Let's Encrypt.
|
||||
caddy_1 | By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
|
||||
caddy_1 | https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf
|
||||
caddy_1 | Activating privacy features... done.
|
||||
caddy_1 | https://yourdomain.com
|
||||
caddy_1 | http://yourdomain.com
|
||||
```
|
||||
|
||||
After it finish Press Ctrl + C to exit ...
|
||||
|
||||
#### Stop All Containers and ReRun Caddy and Other Containers on Background
|
||||
|
||||
```
|
||||
$root@midascode:~/laravel/laradock/caddy# docker-compose down
|
||||
$root@midascode:~/laravel/laradock/caddy# docker-compose up -d mysql caddy
|
||||
```
|
||||
View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
|
||||
|
||||
##### Note that Certificate will be Automatically Renew By Caddy
|
||||
|
||||
>References:
|
||||
>
|
||||
- [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04)
|
||||
- [https://www.digitalocean.com/products/one-click-apps/docker/](https://www.digitalocean.com/products/one-click-apps/docker/)
|
||||
- [https://docs.docker.com/engine/installation/linux/ubuntulinux/](https://docs.docker.com/engine/installation/linux/ubuntulinux/)
|
||||
- [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
|
||||
- [https://caddyserver.com/docs/automatic-https](https://caddyserver.com/docs/automatic-https)
|
||||
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
|
||||
- [https://caddyserver.com/docs/caddyfile](https://caddyserver.com/docs/caddyfile)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
17
apache2/Dockerfile
Normal file
17
apache2/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM webdevops/apache:ubuntu-16.04
|
||||
|
||||
MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com>
|
||||
|
||||
ARG PHP_SOCKET="php-fpm:9000"
|
||||
|
||||
ENV WEB_PHP_SOCKET=$PHP_SOCKET
|
||||
|
||||
ENV WEB_DOCUMENT_ROOT=/var/www/laravel/public
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
WORKDIR /var/www/laravel/public
|
||||
|
||||
ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
|
||||
|
||||
CMD ["supervisord"]
|
@ -7,8 +7,10 @@ RUN apt-get update && apt-get install -y curl
|
||||
RUN curl -sL https://github.com/ptrofimov/beanstalk_console/archive/master.tar.gz | tar xvz -C /tmp
|
||||
RUN mv /tmp/beanstalk_console-master /source
|
||||
|
||||
RUN apt-get remove --purge -y curl && apt-get autoclean && apt-get clean
|
||||
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
RUN apt-get remove --purge -y curl && \
|
||||
apt-get autoclean && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
EXPOSE 2080
|
||||
|
||||
|
18
caddy/Caddyfile
Normal file
18
caddy/Caddyfile
Normal file
@ -0,0 +1,18 @@
|
||||
# Docs: https://caddyserver.com/docs/caddyfile
|
||||
0.0.0.0:80
|
||||
root /var/www/laravel/public
|
||||
fastcgi / php-fpm:9000 php {
|
||||
index index.php
|
||||
}
|
||||
rewrite {
|
||||
r .*
|
||||
ext /
|
||||
to /index.php?{query}
|
||||
}
|
||||
gzip
|
||||
browse
|
||||
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
|
24
caddy/Dockerfile
Normal file
24
caddy/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
FROM alpine:3.4
|
||||
|
||||
MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com>
|
||||
|
||||
ENV caddy_version=0.9.1
|
||||
|
||||
LABEL caddy_version="$caddy_version" architecture="amd64"
|
||||
|
||||
RUN apk update \
|
||||
&& apk upgrade \
|
||||
&& apk add tar curl
|
||||
|
||||
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/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
|
||||
|
||||
EXPOSE 80 443 2015
|
||||
|
||||
WORKDIR /var/www/laravel/public
|
||||
|
||||
CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"]
|
@ -2,45 +2,61 @@ version: '2'
|
||||
|
||||
services:
|
||||
|
||||
### Workspace Utilities Container ###########################
|
||||
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_XDEBUG=false
|
||||
- INSTALL_MONGO=false
|
||||
- INSTALL_NODE=false
|
||||
- INSTALL_DRUSH=false
|
||||
- COMPOSER_GLOBAL_INSTALL=false
|
||||
- INSTALL_WORKSPACE_SSH=false
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
extra_hosts:
|
||||
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
|
||||
- "dockerhost:10.0.75.1"
|
||||
tty: true
|
||||
|
||||
### PHP-FPM Container #######################################
|
||||
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
args:
|
||||
- INSTALL_XDEBUG=false
|
||||
- INSTALL_MONGO=false
|
||||
- INSTALL_ZIP_ARCHIVE=false
|
||||
- INSTALL_MEMCACHED=false
|
||||
- INSTALL_OPCACHE=false
|
||||
dockerfile: Dockerfile-70
|
||||
volumes_from:
|
||||
- application
|
||||
- volumes_source
|
||||
expose:
|
||||
- "9000"
|
||||
links:
|
||||
- workspace
|
||||
|
||||
### Laravel Application Code Container ######################
|
||||
|
||||
application:
|
||||
build: ./application
|
||||
volumes:
|
||||
- ../:/var/www/laravel
|
||||
|
||||
### Databases Data Container ################################
|
||||
|
||||
data:
|
||||
build: ./data
|
||||
volumes:
|
||||
- /var/lib/mysql:/var/lib/mysql
|
||||
- /var/lib/postgres:/var/lib/postgres
|
||||
- /var/lib/mariadb:/var/lib/mariadb
|
||||
- /var/lib/memcached:/var/lib/memcached
|
||||
- /var/lib/redis:/data
|
||||
- /var/lib/neo4j:/var/lib/neo4j/data
|
||||
- /var/lib/mongo:/data/db
|
||||
extra_hosts:
|
||||
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
|
||||
- "dockerhost:10.0.75.1"
|
||||
environment:
|
||||
# IMPORTANT: Set the Remote Interpreter entry matching name to `laravel`
|
||||
- PHP_IDE_CONFIG="serverName=laravel"
|
||||
|
||||
### Nginx Server Container ##################################
|
||||
|
||||
nginx:
|
||||
build: ./nginx
|
||||
build:
|
||||
context: ./nginx
|
||||
args:
|
||||
- PHP_UPSTREAM=php-fpm
|
||||
volumes_from:
|
||||
- application
|
||||
- volumes_source
|
||||
volumes:
|
||||
- ./logs/nginx/:/var/log/nginx
|
||||
ports:
|
||||
@ -49,12 +65,40 @@ services:
|
||||
links:
|
||||
- php-fpm
|
||||
|
||||
### Apache Server Container ##################################
|
||||
|
||||
apache2:
|
||||
build:
|
||||
context: ./apache2
|
||||
args:
|
||||
- PHP_SOCKET="php-fpm:9000"
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
volumes:
|
||||
- ./logs/apache2:/var/log/apache2
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
links:
|
||||
- php-fpm
|
||||
|
||||
### HHVM Container ##########################################
|
||||
|
||||
hhvm:
|
||||
build: ./hhvm
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
expose:
|
||||
- "9000"
|
||||
links:
|
||||
- workspace
|
||||
|
||||
### MySQL Container #########################################
|
||||
|
||||
mysql:
|
||||
build: ./mysql
|
||||
volumes_from:
|
||||
- data
|
||||
- volumes_data
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
@ -68,7 +112,7 @@ services:
|
||||
postgres:
|
||||
build: ./postgres
|
||||
volumes_from:
|
||||
- data
|
||||
- volumes_data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
@ -81,7 +125,7 @@ services:
|
||||
mariadb:
|
||||
build: ./mariadb
|
||||
volumes_from:
|
||||
- data
|
||||
- volumes_data
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
@ -100,7 +144,7 @@ services:
|
||||
environment:
|
||||
- NEO4J_AUTH=homestead:secret
|
||||
volumes_from:
|
||||
- data
|
||||
- volumes_data
|
||||
|
||||
### MongoDB Container #######################################
|
||||
|
||||
@ -109,14 +153,14 @@ services:
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes_from:
|
||||
- data
|
||||
- volumes_data
|
||||
|
||||
### Redis Container #########################################
|
||||
|
||||
redis:
|
||||
build: ./redis
|
||||
volumes_from:
|
||||
- data
|
||||
- volumes_data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
|
||||
@ -125,7 +169,7 @@ services:
|
||||
memcached:
|
||||
build: ./memcached
|
||||
volumes_from:
|
||||
- data
|
||||
- volumes_data
|
||||
ports:
|
||||
- "11211:11211"
|
||||
links:
|
||||
@ -150,15 +194,62 @@ services:
|
||||
links:
|
||||
- beanstalkd
|
||||
|
||||
### Workspace Utilities Container ###########################
|
||||
### Caddy Server Container ##################################
|
||||
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
INSTALL_PRESTISSIMO: ${INSTALL_PRESTISSIMO}
|
||||
caddy:
|
||||
build: ./caddy
|
||||
volumes_from:
|
||||
- application
|
||||
tty: true
|
||||
- volumes_source
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "2015:2015"
|
||||
volumes:
|
||||
- ./caddy/Caddyfile:/etc/Caddyfile
|
||||
- ./logs/caddy:/var/log/caddy
|
||||
links:
|
||||
- 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 ######################
|
||||
|
||||
volumes_source:
|
||||
build: ./volumes/application
|
||||
volumes:
|
||||
- ../:/var/www/laravel
|
||||
# Demonstration of how to mount multiple sites
|
||||
# - ../../site_a/:/var/www/site_a
|
||||
# - ../../site_b/:/var/www/site_b
|
||||
|
||||
### Databases Data Container ################################
|
||||
|
||||
volumes_data:
|
||||
build: ./volumes/data
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
- ./data/postgres:/var/lib/postgres
|
||||
- ./data/memcached:/var/lib/memcached
|
||||
- ./data/redis:/data
|
||||
- ./data/neo4j:/var/lib/neo4j/data
|
||||
- ./data/mongo:/data/db
|
||||
- ./data/sessions:/sessions
|
||||
|
||||
### Add more Containers below ###############################
|
||||
|
23
hhvm/Dockerfile
Normal file
23
hhvm/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
FROM ubuntu:14.04
|
||||
|
||||
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
|
||||
|
||||
RUN apt-get update -y \
|
||||
&& apt-get install -y software-properties-common \
|
||||
&& add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main" \
|
||||
&& apt-get update -y \
|
||||
&& apt-get install -y hhvm \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p /var/www/laravel
|
||||
|
||||
ADD server.ini /etc/hhvm/server.ini
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
|
||||
WORKDIR /var/www/laravel
|
||||
|
||||
CMD ["/usr/bin/hhvm", "-m", "server", "-c", "/etc/hhvm/server.ini"]
|
||||
|
||||
EXPOSE 9000
|
20
hhvm/server.ini
Normal file
20
hhvm/server.ini
Normal file
@ -0,0 +1,20 @@
|
||||
; php options
|
||||
|
||||
pid = /var/run/hhvm/pid
|
||||
|
||||
; hhvm specific
|
||||
hhvm.server.port = 9000
|
||||
hhvm.server.type = fastcgi
|
||||
hhvm.server.default_document = index.php
|
||||
hhvm.server.error_document404 = index.php
|
||||
hhvm.server.upload.upload_max_file_size = 25M
|
||||
hhvm.log.level = Error
|
||||
hhvm.log.header = true
|
||||
hhvm.log.access[default][file] = /var/log/hhvm/access.log
|
||||
hhvm.log.access[default][format] = "%h %l %u %t \"%r\" %>s %b"
|
||||
hhvm.server.source_root=/var/www/laravel/public
|
||||
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
|
||||
|
||||
; Uncomment to log to files instead of STDOUT
|
||||
;hhvm.log.use_log_file = true
|
||||
;hhvm.log.file = /var/log/hhvm/error.log
|
@ -1,13 +1,18 @@
|
||||
FROM nginx:latest
|
||||
FROM nginx:alpine
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
ADD nginx.conf /etc/nginx/
|
||||
ADD laravel.conf /etc/nginx/sites-available/
|
||||
COPY sites/*.conf /etc/nginx/sites-available/
|
||||
|
||||
RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf
|
||||
ARG PHP_UPSTREAM=php-fpm
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
RUN apk update \
|
||||
&& apk upgrade \
|
||||
&& apk add --no-cache bash \
|
||||
&& adduser -D -H -u 1000 -s /bin/bash www-data \
|
||||
&& rm /etc/nginx/conf.d/default.conf \
|
||||
&& echo "upstream php-upstream { server ${PHP_UPSTREAM}:9000; }" > /etc/nginx/conf.d/upstream.conf
|
||||
|
||||
CMD ["nginx"]
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
user www-data;
|
||||
worker_processes 4;
|
||||
pid /run/nginx.pid;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 2048;
|
||||
@ -15,15 +16,14 @@ http {
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 15;
|
||||
types_hash_max_size 2048;
|
||||
client_max_body_size 20M;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log on;
|
||||
error_log on;
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-available/*;
|
||||
open_file_cache max=100;
|
||||
}
|
||||
|
||||
daemon off;
|
||||
|
57
nginx/sites/framework-examples/drupal_8.conf
Normal file
57
nginx/sites/framework-examples/drupal_8.conf
Normal file
@ -0,0 +1,57 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
#domain name
|
||||
server_name drupal8.dev;
|
||||
|
||||
#file document root. This has to match one of the volumes in docer-composer.yml
|
||||
root /var/www/drupal8;
|
||||
|
||||
# This is the full path to your index file
|
||||
index index.php index.html index.htm;
|
||||
|
||||
## serve imagecache files directly or redirect to drupal if they do not exist.
|
||||
location ~* files/styles {
|
||||
access_log off;
|
||||
expires 30d;
|
||||
try_files $uri @drupal;
|
||||
}
|
||||
|
||||
## serve imagecache files directly or redirect to drupal if they do not exist.
|
||||
location ~* ^.+.(xsl|xml)$ {
|
||||
access_log off;
|
||||
expires 1d;
|
||||
try_files $uri @drupal;
|
||||
}
|
||||
|
||||
## Images and static content is treated different
|
||||
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
|
||||
access_log off;
|
||||
expires 30d;
|
||||
}
|
||||
|
||||
location / {
|
||||
index index.php;
|
||||
# This is cool because no php is touched for static content
|
||||
try_files $uri $uri/ @rewrite;
|
||||
expires max;
|
||||
}
|
||||
|
||||
location @drupal {
|
||||
rewrite ^/(.*)$ /index.php?q=$1 last;
|
||||
}
|
||||
|
||||
location @rewrite {
|
||||
# Some modules enforce no slash (/) at the end of the URL
|
||||
# Else this rewrite block wouldn't be needed (GlobalRedirect)
|
||||
rewrite ^/(.*)$ /index.php?q=$1;
|
||||
}
|
||||
|
||||
location ~ .php$ {
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
server {
|
||||
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
|
||||
server_name laravel;
|
||||
root /var/www/laravel/public;
|
||||
index index.php index.html index.htm;
|
||||
|
28
nginx/sites/site_a.conf
Normal file
28
nginx/sites/site_a.conf
Normal file
@ -0,0 +1,28 @@
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name site_a;
|
||||
root /var/www/site_a/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
28
nginx/sites/site_b.conf
Normal file
28
nginx/sites/site_b.conf
Normal file
@ -0,0 +1,28 @@
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name site_b;
|
||||
root /var/www/site_b/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
FROM php:5.5-fpm
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
ADD ./laravel.ini /usr/local/etc/php/conf.d
|
||||
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libpq-dev \
|
||||
libmemcached-dev \
|
||||
curl \
|
||||
libpng12-dev \
|
||||
libfreetype6-dev \
|
||||
libssl-dev \
|
||||
libmcrypt-dev \
|
||||
--no-install-recommends \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
# install mcrypt library
|
||||
RUN docker-php-ext-install mcrypt
|
||||
|
||||
# Install mongodb driver
|
||||
RUN pecl install mongodb
|
||||
|
||||
# configure gd library
|
||||
RUN docker-php-ext-configure gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/freetype2
|
||||
|
||||
# Install extensions using the helper script provided by the base image
|
||||
RUN docker-php-ext-install \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
gd
|
||||
|
||||
# Install memcached
|
||||
RUN pecl install memcached \
|
||||
&& docker-php-ext-enable memcached
|
||||
|
||||
# Install xdebug
|
||||
RUN pecl install xdebug \
|
||||
&& docker-php-ext-enable xdebug
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
|
||||
WORKDIR /var/www/laravel
|
||||
|
||||
CMD ["php-fpm"]
|
||||
|
||||
EXPOSE 9000
|
@ -1,45 +1,112 @@
|
||||
FROM php:5.6-fpm
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Image Setup
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# To edit the 'php-fpm' base Image, visit its repository on Github
|
||||
# https://github.com/LaraDock/php-fpm
|
||||
#
|
||||
# To change its version, see the available Tags on the Docker Hub:
|
||||
# https://hub.docker.com/r/laradock/php-fpm/tags/
|
||||
#
|
||||
|
||||
FROM laradock/php-fpm:5.6--1.2
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Mandatory Software's Installation
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
|
||||
# are installed on the base image 'laradock/php-fpm' image. If you want
|
||||
# to add more Software's or remove existing one, you need to edit the
|
||||
# base image (https://github.com/LaraDock/php-fpm).
|
||||
#
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Optional Software's Installation
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# Optional Software's will only be installed if you set them to `true`
|
||||
# in the `docker-compose.yml` before the build.
|
||||
# Example:
|
||||
# - INSTALL_ZIP_ARCHIVE=true
|
||||
#
|
||||
|
||||
#####################################
|
||||
# xDebug:
|
||||
#####################################
|
||||
|
||||
ARG INSTALL_XDEBUG=true
|
||||
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
|
||||
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
|
||||
# Install the xdebug extension
|
||||
pecl install xdebug && \
|
||||
docker-php-ext-enable xdebug \
|
||||
;fi
|
||||
|
||||
# Copy xdebug configration for remote debugging
|
||||
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
#####################################
|
||||
# MongoDB:
|
||||
#####################################
|
||||
|
||||
ARG INSTALL_MONGO=true
|
||||
ENV INSTALL_MONGO ${INSTALL_MONGO}
|
||||
RUN if [ ${INSTALL_MONGO} = true ]; then \
|
||||
# Install the mongodb extension
|
||||
pecl install mongodb && \
|
||||
docker-php-ext-enable mongodb \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# ZipArchive:
|
||||
#####################################
|
||||
|
||||
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 && \
|
||||
docker-php-ext-enable zip \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# PHP Memcached:
|
||||
#####################################
|
||||
|
||||
ARG INSTALL_MEMCACHED=true
|
||||
ENV INSTALL_MEMCACHED ${INSTALL_MEMCACHED}
|
||||
RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
|
||||
# Install the php memcached extension
|
||||
pecl install memcached && \
|
||||
docker-php-ext-enable memcached \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# 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 \
|
||||
;fi
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touch
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
ADD ./laravel.ini /usr/local/etc/php/conf.d
|
||||
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libpq-dev \
|
||||
libmemcached-dev \
|
||||
curl \
|
||||
libpng12-dev \
|
||||
libfreetype6-dev \
|
||||
libssl-dev \
|
||||
libmcrypt-dev \
|
||||
--no-install-recommends \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
# install mcrypt library
|
||||
RUN docker-php-ext-install mcrypt
|
||||
|
||||
# Install mongodb driver
|
||||
RUN pecl install mongodb
|
||||
|
||||
# configure gd library
|
||||
RUN docker-php-ext-configure gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/freetype2
|
||||
|
||||
# Install extensions using the helper script provided by the base image
|
||||
RUN docker-php-ext-install \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
gd
|
||||
|
||||
# Install memcached
|
||||
RUN pecl install memcached \
|
||||
&& docker-php-ext-enable memcached
|
||||
|
||||
# Install xdebug
|
||||
RUN pecl install xdebug \
|
||||
&& docker-php-ext-enable xdebug
|
||||
RUN rm -r /var/lib/apt/lists/*
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
|
||||
|
@ -1,49 +1,125 @@
|
||||
FROM php:7.0-fpm
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Image Setup
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# To edit the 'php-fpm' base Image, visit its repository on Github
|
||||
# https://github.com/LaraDock/php-fpm
|
||||
#
|
||||
# To change its version, see the available Tags on the Docker Hub:
|
||||
# https://hub.docker.com/r/laradock/php-fpm/tags/
|
||||
#
|
||||
|
||||
FROM laradock/php-fpm:7.0--1.2
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Mandatory Software's Installation
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
|
||||
# are installed on the base image 'laradock/php-fpm' image. If you want
|
||||
# to add more Software's or remove existing one, you need to edit the
|
||||
# base image (https://github.com/LaraDock/php-fpm).
|
||||
#
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Optional Software's Installation
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# Optional Software's will only be installed if you set them to `true`
|
||||
# in the `docker-compose.yml` before the build.
|
||||
# Example:
|
||||
# - INSTALL_ZIP_ARCHIVE=true
|
||||
#
|
||||
|
||||
#####################################
|
||||
# xDebug:
|
||||
#####################################
|
||||
|
||||
ARG INSTALL_XDEBUG=true
|
||||
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
|
||||
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
|
||||
# Install the xdebug extension
|
||||
pecl install xdebug && \
|
||||
docker-php-ext-enable xdebug \
|
||||
;fi
|
||||
|
||||
# Copy xdebug configration for remote debugging
|
||||
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
#####################################
|
||||
# MongoDB:
|
||||
#####################################
|
||||
|
||||
ARG INSTALL_MONGO=true
|
||||
ENV INSTALL_MONGO ${INSTALL_MONGO}
|
||||
RUN if [ ${INSTALL_MONGO} = true ]; then \
|
||||
# Install the mongodb extension
|
||||
pecl install mongodb && \
|
||||
docker-php-ext-enable mongodb \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# ZipArchive:
|
||||
#####################################
|
||||
|
||||
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 && \
|
||||
docker-php-ext-enable zip \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# PHP Memcached:
|
||||
#####################################
|
||||
|
||||
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" \
|
||||
&& mkdir -p memcached \
|
||||
&& tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
|
||||
&& ( \
|
||||
cd memcached \
|
||||
&& phpize \
|
||||
&& ./configure \
|
||||
&& make -j$(nproc) \
|
||||
&& make install \
|
||||
) \
|
||||
&& rm -r memcached \
|
||||
&& rm /tmp/memcached.tar.gz \
|
||||
&& docker-php-ext-enable memcached \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# 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 \
|
||||
;fi
|
||||
|
||||
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touch
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
ADD ./laravel.ini /usr/local/etc/php/conf.d
|
||||
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libpq-dev \
|
||||
libmemcached-dev \
|
||||
curl \
|
||||
libpng12-dev \
|
||||
libfreetype6-dev \
|
||||
libssl-dev \
|
||||
libmcrypt-dev \
|
||||
--no-install-recommends \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
# install mcrypt library
|
||||
RUN docker-php-ext-install mcrypt
|
||||
|
||||
# Install mongodb driver
|
||||
RUN pecl install mongodb
|
||||
|
||||
# configure gd library
|
||||
RUN docker-php-ext-configure gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/freetype2
|
||||
|
||||
# Install extensions using the helper script provided by the base image
|
||||
RUN docker-php-ext-install \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
gd
|
||||
|
||||
# Install Memcached for php 7
|
||||
RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
|
||||
&& mkdir -p /usr/src/php/ext/memcached \
|
||||
&& tar -C /usr/src/php/ext/memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
|
||||
&& docker-php-ext-configure memcached \
|
||||
&& docker-php-ext-install memcached \
|
||||
&& rm /tmp/memcached.tar.gz
|
||||
|
||||
# Install xdebug
|
||||
RUN pecl install xdebug \
|
||||
&& docker-php-ext-enable xdebug
|
||||
RUN rm -r /var/lib/apt/lists/*
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
|
||||
|
@ -1,4 +1,13 @@
|
||||
date.timezone=UTC
|
||||
display_errors=Off
|
||||
log_errors=On
|
||||
extension=mongodb.so
|
||||
|
||||
; Maximum amount of memory a script may consume (128MB)
|
||||
; http://php.net/memory-limit
|
||||
memory_limit = 128M
|
||||
; Maximum allowed size for uploaded files.
|
||||
; http://php.net/upload-max-filesize
|
||||
upload_max_filesize = 20M
|
||||
; Sets max size of post data allowed.
|
||||
; http://php.net/post-max-size
|
||||
post_max_size = 20M
|
||||
|
12
php-fpm/xdebug.ini
Normal file
12
php-fpm/xdebug.ini
Normal file
@ -0,0 +1,12 @@
|
||||
; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
|
||||
|
||||
xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_connect_back=1
|
||||
xdebug.cli_color=1
|
||||
xdebug.remote_handler=dbgp
|
||||
xdebug.remote_mode=req
|
||||
|
||||
xdebug.remote_port=9000
|
||||
xdebug.remote_host=dockerhost
|
||||
xdebug.idekey=PHPSTORM
|
11
phpmyadmin/Dockerfile
Normal file
11
phpmyadmin/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
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
|
||||
|
||||
ENTRYPOINT [ "/run.sh" ]
|
@ -1,96 +1,177 @@
|
||||
FROM phusion/baseimage:latest
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Image Setup
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# To edit the 'workspace' base Image, visit its repository on Github
|
||||
# https://github.com/LaraDock/workspace
|
||||
#
|
||||
# To change its version, see the available Tags on the Docker Hub:
|
||||
# https://hub.docker.com/r/laradock/workspace/tags/
|
||||
#
|
||||
|
||||
FROM laradock/workspace:1.1
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive
|
||||
RUN locale-gen en_US.UTF-8
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Mandatory Software's Installation
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# Mandatory Software's such as ("php7.0-cli", "git", "vim", ....) are
|
||||
# installed on the base image 'laradock/workspace' image. If you want
|
||||
# to add more Software's or remove existing one, you need to edit the
|
||||
# base image (https://github.com/LaraDock/workspace).
|
||||
#
|
||||
|
||||
ENV LANGUAGE=en_US.UTF-8
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
ENV LC_CTYPE=UTF-8
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV TERM xterm
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Optional Software's Installation
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# Optional Software's will only be installed if you set them to `true`
|
||||
# in the `docker-compose.yml` before the build.
|
||||
#
|
||||
# - INSTALL_XDEBUG= false
|
||||
# - INSTALL_MONGO= false
|
||||
# - COMPOSER_GLOBAL_INSTALL= false
|
||||
# - INSTALL_NODE= false
|
||||
# - INSTALL_DRUSH= false
|
||||
#
|
||||
|
||||
# Install "software-properties-common" (for the "add-apt-repository")
|
||||
RUN apt-get update && apt-get install -y \
|
||||
software-properties-common
|
||||
#####################################
|
||||
# xDebug:
|
||||
#####################################
|
||||
|
||||
# Add the "PHP 7" ppa
|
||||
RUN add-apt-repository -y \
|
||||
ppa:ondrej/php
|
||||
# Check if xDebug needs to be installed
|
||||
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 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 \
|
||||
;fi
|
||||
# ADD for REMOTE debugging
|
||||
COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini
|
||||
|
||||
# Install PHP-CLI 7, some PHP extentions and some useful Tools with APT
|
||||
RUN apt-get update && apt-get install -y --force-yes \
|
||||
php7.0-cli \
|
||||
php7.0-common \
|
||||
php7.0-curl \
|
||||
php7.0-json \
|
||||
php7.0-xml \
|
||||
php7.0-mbstring \
|
||||
php7.0-mcrypt \
|
||||
php7.0-mysql \
|
||||
php7.0-pgsql \
|
||||
php7.0-sqlite \
|
||||
php7.0-sqlite3 \
|
||||
php7.0-zip \
|
||||
php7.0-memcached \
|
||||
php7.0-gd \
|
||||
php7.0-xdebug \
|
||||
php-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libedit-dev \
|
||||
libssl-dev \
|
||||
libxml2-dev \
|
||||
xz-utils \
|
||||
sqlite3 \
|
||||
libsqlite3-dev \
|
||||
git \
|
||||
curl \
|
||||
vim \
|
||||
nano
|
||||
|
||||
# Clean up, to free some space
|
||||
RUN apt-get clean
|
||||
#####################################
|
||||
# ssh:
|
||||
#####################################
|
||||
|
||||
# remove load xdebug extension (only load on phpunit command)
|
||||
RUN sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini
|
||||
# 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
|
||||
|
||||
# Add bin folder of composer to PATH.
|
||||
RUN echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc
|
||||
|
||||
# Install Composer
|
||||
RUN curl -s http://getcomposer.org/installer | php \
|
||||
&& mv composer.phar /usr/local/bin/composer
|
||||
#####################################
|
||||
# MongoDB:
|
||||
#####################################
|
||||
|
||||
# Load xdebug Zend extension with phpunit command
|
||||
RUN echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc
|
||||
# Check if Mongo needs to be installed
|
||||
ARG INSTALL_MONGO=true
|
||||
ENV INSTALL_MONGO ${INSTALL_MONGO}
|
||||
RUN if [ ${INSTALL_MONGO} = true ]; then \
|
||||
# Install the mongodb extension
|
||||
pecl install mongodb && \
|
||||
echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \
|
||||
;fi
|
||||
|
||||
# Install mongodb extension
|
||||
RUN pecl install mongodb
|
||||
RUN echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini
|
||||
#####################################
|
||||
# Non-Root User:
|
||||
#####################################
|
||||
|
||||
# Install nvm (Node Version Manager)
|
||||
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
|
||||
# Add a non-root user to prevent files being created with root permissions on host machine.
|
||||
ARG PUID=1000
|
||||
ARG PGID=1000
|
||||
RUN groupadd -g $PGID laradock && \
|
||||
useradd -u $PUID -g laradock -m laradock
|
||||
|
||||
ENV NVM_DIR=/root/.nvm
|
||||
#####################################
|
||||
# Composer:
|
||||
#####################################
|
||||
|
||||
# Install stable node
|
||||
RUN . ~/.nvm/nvm.sh \
|
||||
&& nvm install stable \
|
||||
&& nvm use stable \
|
||||
&& nvm alias stable \
|
||||
&& npm install -g gulp bower
|
||||
# Add the composer.json
|
||||
COPY ./composer.json /home/laradock/.composer/composer.json
|
||||
|
||||
# Source the bash
|
||||
RUN . ~/.bashrc
|
||||
# Make sure that ~/.composer belongs to laradock
|
||||
RUN chown -R laradock:laradock /home/laradock/.composer
|
||||
USER laradock
|
||||
|
||||
# Check if global install need to be ran
|
||||
ARG COMPOSER_GLOBAL_INSTALL=true
|
||||
ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL}
|
||||
RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
|
||||
# run the install
|
||||
composer global install \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# Drush:
|
||||
#####################################
|
||||
USER root
|
||||
ENV DRUSH_VERSION 8.1.2
|
||||
ARG INSTALL_DRUSH=true
|
||||
ENV INSTALL_DRUSH ${INSTALL_DRUSH}
|
||||
RUN if [ ${INSTALL_DRUSH} = true ]; then \
|
||||
# Install Drush 8 with the phar file.
|
||||
curl -fsSL -o /usr/local/bin/drush https://github.com/drush-ops/drush/releases/download/$DRUSH_VERSION/drush.phar | bash && \
|
||||
chmod +x /usr/local/bin/drush && \
|
||||
drush core-status \
|
||||
;fi
|
||||
|
||||
USER laradock
|
||||
|
||||
#####################################
|
||||
# Node / NVM:
|
||||
#####################################
|
||||
|
||||
# Check if NVM needs to be installed
|
||||
ARG INSTALL_NODE=true
|
||||
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 && \
|
||||
. ~/.nvm/nvm.sh && \
|
||||
nvm install stable && \
|
||||
nvm use stable && \
|
||||
nvm alias stable && \
|
||||
npm install -g gulp bower \
|
||||
;fi
|
||||
|
||||
# Wouldn't execute when added to the RUN statement in the above block
|
||||
# Source NVM when loading bash since ~/.profile isn't loaded on non-login shell
|
||||
RUN if [ ${INSTALL_NODE} = true ]; then \
|
||||
echo "" >> ~/.bashrc && \
|
||||
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc && \
|
||||
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
|
||||
;fi
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touch
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
# Clean up
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
USER root
|
||||
RUN apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Set default work directory
|
||||
WORKDIR /var/www/laravel
|
||||
|
||||
# Install optional software
|
||||
ARG INSTALL_PRESTISSIMO=false
|
||||
RUN if [ "$INSTALL_PRESTISSIMO" = true ] ; then \
|
||||
composer global require "hirak/prestissimo:^0.3"; \
|
||||
fi
|
5
workspace/composer.json
Normal file
5
workspace/composer.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"require": {
|
||||
|
||||
}
|
||||
}
|
51
workspace/insecure_id_rsa
Normal file
51
workspace/insecure_id_rsa
Normal 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
|
||||
/uqdhyEYXXEdy38CeV2dEYh8HbRp8hR/Dhu0A0IItvsm5GvKlIQgBQwXK8+db1e7
|
||||
uf4Yo7EeqxW/QSojiyZonDbnD6trghnmVULX1TD+BLDKO2Ett5++w9aFq9YpreeE
|
||||
WKLZtCfcjGUoxK7h0QjQrKTYOjMMdawqgq/PAep2tSjiFnke0l5N/Ak8Q4ocLbpy
|
||||
X5BwcKlnlpjZrr+drxCNv6JKE79K7ITfhUyY5GBGl5N+mvL2g1eNyRZk5xNq0es4
|
||||
g1OaLDuUBoTKdsXokiPMD3Ql+J7+RCoC9PuGutdCAIU2u9CoFAfKJpsKh+sGRyri
|
||||
zvD5hlS31F78zif7W5ubi9supA6etJYbK+mwcDsJgmtc+q51xsH3T1ODvRcbtzvY
|
||||
FE8JzuchN4aPtsY+W/waTDVDdymFvPSsYjX7Blq3fnpg2uJKtzWEIQE+rY7gC3rN
|
||||
oNSE4YFbIAjTM4kIuIFnkVq3o2BmQ7WHjb3USelhFxBPJ67nBMLS3ShXLjyiu22U
|
||||
8RxKcbOKpEimuCKRSVEdpsNnps3h2y8c2PPWWS7LGzAiCepLjXwqHLe4L/cvx8S9
|
||||
KZRXQneakkKToguV7N9p0O9prjJckb4jo941iaDepVZIHbuP8QKCAQEA+vABCKnn
|
||||
8PA4RWixPcIybj6iQpHPzt6uZxv3il3IoY3Anm2+EHbloE9VcH3phQEAoTQsxd+k
|
||||
octHHqdJi6YxOTmmsHl3jilA3kKg0A7Rin702DObC3c9VSOe7V9rizPQnFewkyDP
|
||||
mpOoW3by0DYv0DFtA8zNfgSkFeqZEoBnQyMom9lBYcJ9VKriUfdCvPgh3ZV/SzEf
|
||||
cp6ZtMLRvtEWzOx75cww6kLvUuUekQl/7Ubr36Oz+71B66VN59udSLYPAb+stzhb
|
||||
QSU7LbNKaLlygBREqnTeXj+VCXGnrxORZS1FfqO9unbxg/FYBDBMt/2jXt6Elz62
|
||||
YgjDEtGjcTA/rQKCAQEA+aXKW6zufDG88DPsX5psl7Cu2Fwhq1j5ULGvpkuucaVs
|
||||
snONmFqi4jH7LEZVjEcHg6GhDqGytaaUr1KhXVWttn0om2qZIKFg7BR7E5PR9HKu
|
||||
Ig0do68pPf/5MKT6TKq1gB1l8B481dVc8tmaHjHbLz9UlIf8uLbXfP1EYyADAqJ4
|
||||
xtQNtOj7uz0k5ayIgWU6scGC3ElLTzfWusXPJyWFNV5wAtCI0Xu4U/IdNO0rLiBI
|
||||
8BSC8VC4Maw/a1ZY1nliXBfjmtJ3i7A2s36+YG11vXmi2BKFXa80BM7+L9zptxf2
|
||||
Pv7H1Yvyx4bfVZ2xCTLCyjtUj4wGGkmHMTC8M0gniwKCAQBYzQYQos/Jm7jOFzZh
|
||||
vI9MJC4XkLIRawwcwPDgrj+JrDg12HAiM3EfQfPiUyyIPMqUQXp2q6X++4i3eEu2
|
||||
d6GDtrseSF3emQqznLB78EKG2FadC+YaMKAruOdM6S+Nm1B/gyihaEMPWKGDfJyA
|
||||
wiw5aMRDS/6MUegfOV3iBj6Eq7R7Mm7IwaLIi5B7oRyk8spJN9ZMLZ4LWcTbCvZe
|
||||
qG+BJU7TC2dj/zviAeLHQK1csnRWOABBXcAuO9lN65HFYWf+Hm5oiDEC5MIEciYq
|
||||
2TWDzahfCeyHPcjoBqhodGxHebXWEuvZSK4/GvEiylTb544gzG3vd+ni12bxCe7k
|
||||
50YhAoIBAQCgG2r3dqYQspl49+P9wH0qn97S1eumB88FqJ99KIZ9Tlmy7Rb/ggl6
|
||||
xhFPaOBOsfMowY0YZC3IAEjVVEo3IM7i/cwAONJyMe2GGvCAMspxWudA4WaD5r+t
|
||||
irAXOYdpigYTX0dUQyBDB66v9Uy5VsI6wAQPqlMzZ9g1yfyFEi+8DdUltzP/NXjU
|
||||
sbcrMYbubazB+dhiTQNmj+pAKMLdWVvgSWvO8kz9BLrH47xFiGGsGHqOtqjv+RPY
|
||||
j56wyVT6YCjr5UpMrfSLevzqCzwvfaQIW61LpD0yQz46Y0J0Eds2WMDNz/r7guC2
|
||||
hFJRh2vV+V8h8gEeevAjBcsViir5PKpXAoIBAQC/gAQCLbqo4FylEVST3IP8rxA5
|
||||
RGbLRDJ2j+ywEzOuy2ufGI/CfxeG/+jF5E0/uBRm8rrnMmaJaNr42hF4r5kjNM5u
|
||||
ficOVucU3FluQqae73zfUFeAQBft+4tTH+sR8jo+LvEBGinW1wHv7di45I3at2HM
|
||||
jMtZgWPPIqCBIay0UKysW4eEwXYC9cWg9kPcb2y56zadrKxGZqHOPezH2A1iOuzp
|
||||
vw0mG0xHUY4Eg5aZxcWB1jMf7bbxTAAMxQiBnw0bPEf5zpWzeKL0obxT/NhCgmV7
|
||||
/Fqs0GCbXEEgJo0zAVemALOAYRW3pYvt8FoCOopo4ADyfmdWlAvzCy46k7Fo
|
||||
-----END RSA PRIVATE KEY-----
|
1
workspace/insecure_id_rsa.pub
Normal file
1
workspace/insecure_id_rsa.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD0tfQNVXxVjST53ny/5Op7ot+GeIGEGAEnr9kgYAXK6GqnJ/3UOfWKFxl4gEusLj4hpGrT/GJVx2nIG7d/IaRifJvns+Lak4Wj+17zyPRF54/mic6a0MAREJH5aTOLuSK+DhnhTUqAt4mfdHpYmBXWdTAXDCg8gP5QLdGkdxL9M+GBk4tKiDx1hRfHV9uY6ci0lspQrhnPzzeWLktTA8uWYZlus1gv3SXX6zVD2+XB6/J7ZarNcK9iHoMLddFggSdnGs6kNLJQe0DAwncdeCQizcdXV2A9O33vaY/b0A1obUxuoCit629AwyQ9C/71f3rBSrfgUSb1pOVPmhLRJDZenf/NS8FIW194/u5slvr1u6fj/iiCYctt0PNg00UAnlybWDDKD3l5e8Kbl16uTw1/5AEc6Wl3aCmtWYpwRGeue/hnUzOXr9/SjhQLfB+ZCASt83N+u0kV7ni7G5/04z11dqZwkk6x1SAzWGJnp76piwd4AP2fu8KqNAmWsyEIZmmR5JSGS5i4sGuSGog6rZWop1LwIfNjdOLFbs+rnF0oOmpgZReo8fH+PmOkq3iHaPQvXO3Cj2d52HVxtHI+n2iKjDu3CzHIP31vfqsZKHfmoo3ckFW4yfrPcXy0gQswPj0jJUIbKLb6OfuptUsQ5SvkiwWoW4irnO3lKF9KLo3t7w== insecure@laradock
|
12
workspace/xdebug.ini
Normal file
12
workspace/xdebug.ini
Normal file
@ -0,0 +1,12 @@
|
||||
; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
|
||||
|
||||
xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_connect_back=1
|
||||
xdebug.cli_color=1
|
||||
xdebug.remote_handler=dbgp
|
||||
xdebug.remote_mode=req
|
||||
|
||||
xdebug.remote_port=9000
|
||||
xdebug.remote_host=dockerhost
|
||||
xdebug.idekey=PHPSTORM
|
91
xdebugPhpFpm
Normal file
91
xdebugPhpFpm
Normal file
@ -0,0 +1,91 @@
|
||||
#! /bin/bash
|
||||
|
||||
# NOTE: At the moment, this has only been confirmed to work with PHP 7
|
||||
|
||||
|
||||
# Grab full name of php-fpm container
|
||||
PHP_FPM_CONTAINER=$(docker-compose ps | grep php-fpm | cut -d" " -f 1)
|
||||
|
||||
xdebug_status ()
|
||||
{
|
||||
echo 'xDebug status'
|
||||
|
||||
# If running on Windows, need to prepend with winpty :(
|
||||
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then
|
||||
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
|
||||
else
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
xdebug_start ()
|
||||
{
|
||||
echo 'Start xDebug'
|
||||
|
||||
# And uncomment line with xdebug extension, thus enabling it
|
||||
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' \
|
||||
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
|
||||
|
||||
# If running on Windows, need to prepend with winpty :(
|
||||
if [[ "$(expr substr $(uname -s) 1 5)" == "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'
|
||||
|
||||
else
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
xdebug_stop ()
|
||||
{
|
||||
echo 'Stop xDebug'
|
||||
|
||||
# Comment out xdebug extension line
|
||||
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
|
||||
|
||||
# If running on Windows, need to prepend with winpty :(
|
||||
if [[ "$(expr substr $(uname -s) 1 5)" == "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
|
||||
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
#docker-compose restart php-fpm
|
||||
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
|
||||
else
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
|
||||
# docker-compose restart php-fpm
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
case $@ in
|
||||
stop|STOP)
|
||||
xdebug_stop
|
||||
;;
|
||||
start|START)
|
||||
xdebug_start
|
||||
;;
|
||||
status|STATUS)
|
||||
xdebug_status
|
||||
;;
|
||||
*)
|
||||
echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container."
|
||||
echo "xDebug must have already been installed."
|
||||
echo "Usage:"
|
||||
echo " ./xdebugPhpFpm stop|start|status"
|
||||
|
||||
esac
|
||||
|
||||
exit 1
|
Reference in New Issue
Block a user