Skip to content

Commit

Permalink
Merge branch 'release/v1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
andykuen committed Oct 5, 2019
2 parents 76b525c + 28fe0b7 commit a4f0002
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
APP_NAME=web-php
APP_PORT=8080
PHP_VERSION=7.2

REDIS_HOST=web-redis
REDIS_PORT=6379

DB_DATABASE=example

DB_HOST=web-mysql
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=secret
DB_PASSWORD=root
DB_DATABASE=example
10 changes: 0 additions & 10 deletions Dockerfile

This file was deleted.

22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Docker-AMPR
Apache + Mysql + PHP + Redis 直接在 docker 上運行懶人包
- Apache + fcgid + PHP + Redis + MySQL 直接在 docker 上運行懶人包。
- 使用 [網紅神人等級](https://shazi.info/)[映像檔](https://github.com/shazi7804/docker-apache2-fcgid-worker-php7)
- [English](https://github.com/andykuen/Docker-AMPR/blob/master/README_EN.md)

## 如何使用

Expand Down Expand Up @@ -29,8 +31,22 @@ P.S. 預設網址: `http://127.0.0.1:8080/`
| $ make exec | 進入 container 裡面 |
| $ make del | 解除安裝 Docker-AMPR |

## 相關範例
### 在 Docker-AMPR 開發 Laravel 相關程式
# 環境參數
| 參數 | 說明 | 預設值 |
| ----------- | ---------------------- | -------- |
| APP_NAME | docker container 名稱 | web-php |
| APP_PORT | docker port | 8080 |
| PHP_VERSION | php 版本 | 7.2 |
| REDIS_HOST | redis host | web-redis |
| REDIS_PORT | redis port | 6379 |
| DB_DATABASE | database 名稱 | example |
| DB_HOST | database host | web-mysql |
| DB_PORT | database port | 3306 |
| DB_USERNAME | database 使用者名稱 | root |
| DB_PASSWORD | database 密碼 | root |

# 相關範例
## 在 Docker-AMPR 開發 Laravel 相關程式

1. 進入 container 裡面
```bash
Expand Down
22 changes: 20 additions & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Docker-AMPR
Example for Apache+Mysql+PHP+Redis run on docker
- Example for Apache + mod_fcgid + PHP + Redis + MySQL run on docker
- Use [Mr. shazi](https://shazi.info/)'s [image](https://github.com/shazi7804/docker-apache2-fcgid-worker-php7).
- [中文說明](https://github.com/andykuen/Docker-AMPR/blob/master/README.md)

## How to use

Expand Down Expand Up @@ -27,7 +29,23 @@ Example for Apache+Mysql+PHP+Redis run on docker
| $ make exec | go into APP container |
| $ make del | delete container |

## for Laravel example

# Environment document
| Key | Help | Default |
| ----------- | ---------------------- | --------- |
| APP_NAME | docker container name | web-php |
| APP_PORT | docker port | 8080 |
| PHP_VERSION | php version | 7.2 |
| REDIS_HOST | redis host | web-redis |
| REDIS_PORT | redis port | 6379 |
| DB_DATABASE | database name | example |
| DB_HOST | database host | web-mysql |
| DB_PORT | database port | 3306 |
| DB_USERNAME | database username | root |
| DB_PASSWORD | database password | root |

# Example
## For Laravel framework

1. go into container
```bash
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

9 changes: 9 additions & 0 deletions database/example.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- database example
CREATE DATABASE IF NOT EXISTS `example` CHARACTER SET utf8 COLLATE utf8_unicode_ci;

-- users
CREATE TABLE IF NOT EXISTS `example`.`users` (
`id` VARCHAR(32) COLLATE utf8_unicode_ci NOT NULL,
`name` VARCHAR(32) COLLATE utf8_unicode_ci NULL,
PRIMARY KEY (`id`)
);
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
version: "3.5"
services:
web:
image: shazi7804/apache2-fcgid-worker-php7:${PHP_VERSION}
container_name: ${APP_NAME}
hostname: ${APP_NAME}
networks:
- LAN
build:
context: ./
dockerfile: Dockerfile
ports:
- ${APP_PORT}:8080
- ${APP_PORT}:80
volumes:
- ./:/var/www/html/
working_dir: /var/www/html/
environment:
DB_HOST: ${DB_HOST}
REDIS_HOST: ${REDIS_HOST}
Expand Down Expand Up @@ -45,7 +44,8 @@ services:
- LAN
ports:
- ${REDIS_PORT}:6379

networks:
LAN:
driver: bridge
name: web_LAN
name: ${APP_NAME}_LAN

0 comments on commit a4f0002

Please sign in to comment.