Giter Site home page Giter Site logo

nest's Introduction

nest

nest 是一个用 Docker 搭建的本地 PHP 应用开发与运行环境。

准备

安装 Docker for Windows 或 Docker for Mac。

服务

  • db:使用 mariadb 作为应用的数据库
  • php:解释 php 脚本,使用 php-fpm
  • web:使用 NGINX 作为应用的 web 服务器
  • console:常用工具
  • phpmyadmin:管理数据库的 web 界面

结构

  • app:这个目录存储应用,database 放数据库,web 放应用的代码。
  • services: 环境里定义的服务需要的一些资源,比如 nginx 的配置文件在 nginx/config/default.conf 。
  • docker-compose-dev.yml:定义本地开发环境需要的服务。
  • docker-compose.yml:生产环境需要的服务,暂时为空白。
  • docker-sync.yml:同步文件用的配置文件。
  • example.env:环境文件示例,复制一份这个文件,把复制的文件命名为 .env 。

使用

准备:

git clone https://github.com/ninghao/nest.git
cd nest
cp example.env .env

基本用法:

docker-compose up -d

同步文件:

docker-sync start
docker-compose up -d

或:

docker-sync-stack start

nest's People

Contributors

ninghao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nest's Issues

checking for libzip... not found

checking for libzip... not found
configure: error: Please reinstall the libzip distribution
ERROR: `/tmp/pear/temp/zip/configure --with-php-config=/usr/local/bin/php-config' failed
ERROR: Service 'console' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y git curl wget cron vim locales libfreetype6-dev mariadb-client && rm -rf /var/lib/apt/lists/* && pecl install zip && docker-php-ext-enable zip && docker-php-ext-install mysqli pdo_mysql' returned a non-zero code: 1

修改文件内容后不生效

本地修改了phpinfo.php的内容,修改如下,但是不生效

<?php echo 1;die;phpinfo(); ?>

同步的命令也按文档上的执行过,是不是还需要其他的操作

@ninghao

docker-compose build

ERROR: Service 'php' failed to build: Tag 7.0-fpm not found in repository docker.io/library/php

Cannot find config.m4. Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

你好php:5.6-fpm 安装openssl zlib报Cannot find config.m4请问怎么解决呢我的配置如下
FROM php:5.6-fpm
MAINTAINER

ENV PHPREDIS_VERSION 2.2.8

RUN mkdir -p /usr/src/php/ext/redis
&& curl -L https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1
&& echo 'redis' >> /usr/src/php-available-exts
&& docker-php-ext-install redis

修改为163源

RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak &&
echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list &&
echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list &&
echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list &&
echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list

RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev
libxml2-dev libfreetype6-dev libmcrypt-dev php5-dev autoconf
libbz2-dev automake libtool m4
&& rm -rf /var/lib/apt/lists/* \

&& docker-php-ext-configure --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-mysql=mysqlnd \

--with-mysqli=mysqlnd --with-openssl-dir=/usr/include --with-openssl --with-pdo-mysql=mysqlnd --with-pear \

--enable-sockets --with-freetype-dir=/usr/include --enable-gd-native-ttf --with-zlib --with-libxml-dir=/usr/include \

--with-xmlrpc --enable-zip --enable-fpm --enable-xml --with-curl --with-mcrypt --with-mysql-sock --enable-sysvsem \

--with-iconv --enable-soap --enable-pcntl --enable-cli --enable-sysvshm --enable-shared --with-gnu-ld --enable-opcache \

&& docker-php-ext-configure gd --with-png-dir=/usr/include --with-jpeg-dir=/usr/include --with-freetype-dir=/usr/include --with-openssl-dir=/usr/include
--with-freetype-dir=/usr/include --with-libxml-dir=/usr/include
&& docker-php-ext-install bz2 gd mysqli pdo_mysql zip opcache redis openssl zlib curl xmlrpc mcrypt iconv

ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --enable-mbstring --enable-sockets --enable-gd-native-ttf --enable-zip --enable-xml --enable-sysvsem --enable-soap --enable-pcntl --enable-cli --enable-sysvshm --enable-shared --enable-opcache

Docker for Windows 编译 php 镜像时报错

Docker for Windows 版本:

Client:
 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        Thu Jul 28 21:15:28 2016
 OS/Arch:      windows/amd64

Server:
 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        Thu Jul 28 21:15:28 2016
 OS/Arch:      linux/amd64

Docker Daemon 配置如图:

Docker 自动配置

上面这个是 Docker 默认的配置。

下面这个是我的阿里云容器加速器镜像:

Docker Hub 加速器配置


执行 docker-compose build 报错如下(下面无法正常显示的字符都是 ← 箭头):

Loyalsoldier@Loyalsoldier-PC MINGW64 /d/dev/docker/nest (master)
$ docker-compose build
phpmyadmin uses an image, skipping
redis uses an image, skipping
db uses an image, skipping
Building php
Step 1 : FROM php:7.0-fpm
7.0-fpm: Pulling from library/php

�[0Ba8c3d80b: Pulling fs layer
�[0B7f80f73d: Pulling fs layer
�[0B1ad560e1: Pulling fs layer
�[0B18962010: Pulling fs layer
�[0B840b656b: Pulling fs layer
�[0B85a7aa1b: Pulling fs layer
�[0Bad85eeda: Pulling fs layer
�[0Bc9ac406d: Pulling fs layer
Digest: sha256:863e1098a358898aa8c0f189d225267113dcb96f00762c9452d4bebb5fe752b27.689 kB/7.689 kBB
Status: Downloaded newer image for php:7.0-fpm
 ---> 0073e714952e
Step 2 : MAINTAINER wanghao <[email protected]>
 ---> Running in ad8a8d1af438
 ---> 545ea49c10ae
Removing intermediate container ad8a8d1af438
Step 3 : ENV PHPREDIS_VERSION 3.0.0
 ---> Running in 36fc23fe7dda
 ---> 49110982b266
Removing intermediate container 36fc23fe7dda
Step 4 : RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz     && tar xfz /tmp/redis.tar.gz     && rm -r /tmp/redis.tar.gz     && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis
 ---> Running in 0a138266a469
�[91m  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   124    0   124    0     0      8      0 --:--:--  0:00:14 --:--:--    29�[0m�[91m�[0m�[91m
  9  191k    9 19180    0     0    428      0  0:07:38  0:00:44  0:06:54  3592�[0m�[91m  9  191k    9 19180    0     0    419      0  0:07:48  0:00:45  0:07:03  3279�[0m�[91m  9  191k    9 19180    0     0    410      0  0:07:59  0:00:46
  0:07:13  3049�[0m�[91m 11  191k   11 23290    0     0    486      0  0:06:44  0:00:47  0:05:57  1795�[0m�[91m 13  191k   13 27400    0     0    565      0  0:05:47  0:00:48  0:04:59  2272�[0m�[91m 19  191k   19 38440    0     0    777
     0  0:04:12  0:00:49  0:03:23  4087�[0m�[91m 23  191k   23 45290    0     0    894      0  0:03:39  0:00:50  0:02:49  5342�[0m�[91m 27  191k   27 53510    0     0   1029      0  0:03:10  0:00:51  0:02:19  6526�[0m�[91m 29  191k   29
57620    0     0   1095      0  0:02:59  0:00:52  0:02:07  7302�[0m�[91m 34  191k   34 68580    0     0   1285      0  0:02:32  0:00:53  0:01:39  8398�[0m�[91m 38  191k   38 75430    0     0   1379      0  0:02:22  0:00:54  0:01:28  7064
�[0m�[91m 39  191k   39 78170    0     0   1396      0  0:02:20  0:00:55  0:01:25  6136�[0m�[91m 40  191k   40 79540    0     0   1412      0  0:02:19  0:00:56  0:01:23  6012�[0m�[91m 46  191k   46 90500    0     0   1564      0  0:02:05
  0:00:57  0:01:08  6254�[0m�[91m 48  191k   48 95756    0     0   1615      0  0:02:01  0:00:59  0:01:02  4588�[0m�[91m 50  191k   50 98496    0     0   1649      0  0:01:59  0:00:59  0:01:00  4602�[0m�[91m 55  191k   55  106k    0
0   1812      0  0:01:48  0:01:00  0:00:48  7097�[0m�[91m 66  191k   66  128k    0     0   2138      0  0:01:31  0:01:01  0:00:30 10165�[0m�[91m 82  191k   82  158k    0     0   2604      0  0:01:15  0:01:02  0:00:13 15653�[0m�[91m 93  1
91k   93  180k    0     0   2900      0  0:01:07  0:01:03  0:00:04 20261�[0m�[91m 94  191k   94  181k    0     0   2888      0  0:01:08  0:01:04  0:00:04 18695�[0m�[91m100  191k  100  191k    0     0   3050      0  0:01:04  0:01:04 --:--
:-- 21772
�[0m�[91mmv: �[0m�[91mcannot move 'phpredis-3.0.0' to '/usr/src/php/ext/redis'�[0m�[91m: No such file or directory�[0m�[91m
�[0m�[31mERROR�[0m: Service 'php' failed to build: The command '/bin/sh -c curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz     && tar xfz /tmp/redis.tar.gz     && rm -r /tmp/redis.tar.gz
     && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis' returned a non-zero code: 1

报错mv: cannot move 'phpredis-3.0.0' to '/usr/src/php/ext/redis': No such file or directory

环境
mac ox 10.12.2
Docker version 1.13.0, build 49bf474
docker-machine version 0.9.0, build 15fd4c7

docker-compose build
unison uses an image, skipping
phpmyadmin uses an image, skipping
redis uses an image, skipping
db uses an image, skipping
Building php
Step 1/7 : FROM php:7.0-fpm
 ---> a5efceb74f9f
Step 2/7 : MAINTAINER wanghao <[email protected]>
 ---> Using cache
 ---> dcc1fc5c0319
Step 3/7 : ENV PHPREDIS_VERSION 3.0.0
 ---> Using cache
 ---> c891158b7764
Step 4/7 : RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz     && tar xfz /tmp/redis.tar.gz     && rm -r /tmp/redis.tar.gz     && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis
 ---> Running in f8fbb6e1e6cd
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   124    0   124    0     0      9      0 --:--:--  0:00:13 --:--:--    28
100  191k  100  191k    0     0   9887      0  0:00:19  0:00:19 --:--:-- 50144
mv: cannot move 'phpredis-3.0.0' to '/usr/src/php/ext/redis': No such file or directory
ERROR: Service 'php' failed to build: The command '/bin/sh -c curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz     && tar xfz /tmp/redis.tar.gz     && rm -r /tmp/redis.tar.gz     && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis' returned a non-zero code: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.