1 Star 0 Fork 2

joeyzh / dockerfile

forked from Micooz / dockerfile 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Introduction

This project contains Dockerfiles that power apporz.com -- my personal website. I want to share my ideas and designs about Web-Deploying using Docker with you.

Structure

structure

The whole app is divided into four Containers:

  1. Nginx is running in Nginx Container. Recieves requests from Clients then respond.
  2. My App business-logic code and scripts is located at WWW Container. It just stores php scripts and static files.
  3. PHP or PHP-FPM is put in PHP-FPM Container, it fetches php scripts from WWW then interpretes and executes them, making response to Nginx Server. If necessary, it will connect to MySQL server as well.
  4. Considering the flexibility and security, MySQL server must be independent of other containers.

Build and Run

Build Images

At first, you should have had Docker installed.

# build Nginx Image
$ sudo docker build --tag micooz/nginx -f nginx/Dockerfile .

# build PHP-FPM Image
$ sudo docker build --tag micooz/php-fpm -f php-fpm/Dockerfile .

# build WWW Image
$ sudo docker build --tag micooz/www -f www/Dockerfile .

# pull MySQL Official Image
$ sudo docker pull mysql:latest

Run Containers

You must run the contaners in the following sequence:

  1. MySQL Container
  2. WWW Container
  3. PHP-FPM Container
  4. Nginx Container

The first two of which can be exchanged.

# Run MySQL Container
$ sudo docker run --name mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql
# see https://github.com/docker-library/docs/tree/master/mysql

# Run WWW Container
$ sudo docker run --name www -d micooz/www

# Run PHP-FPM Container
$ sudo docker run --name php-fpm --volume-from www --link mysql:mysql -d micooz/php-fpm
# see https://github.com/docker-library/docs/tree/master/php

# Run Nginx Container
$ sudo docker run --name nginx -p 80:80 -p 443:443 --volume-from www --link php-fpm:fpmservice -d micooz/nginx
# see https://github.com/docker-library/docs/tree/master/nginx

Have fun!

Author

Micooz micooz@hotmail.com

License

MIT

The MIT License (MIT) Copyright (c) 2015 Micooz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Dockerfiles for deploying applications of apporz.com anywhere. I'd like to share them with you. 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/zedy/dockerfile.git
git@gitee.com:zedy/dockerfile.git
zedy
dockerfile
dockerfile
master

搜索帮助