-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile-5.6.18
93 lines (82 loc) · 3.59 KB
/
Dockerfile-5.6.18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#
# PHP Dockerfile
# 满足laravel5.2版本的基本要求
#
# https://github.com/ibbd/dockerfile-php-fpm
#
# sudo docker build -t ibbd/php-fpm ./
#
# Pull base image.
FROM php:5.6.18-fpm
MAINTAINER Alex Cai "[email protected]"
# Install modules
# composer需要先安装zip
RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
libmcrypt-dev \
libssl-dev \
libsasl2-dev \
&& apt-get autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*
# install php modules
# pecl install php modules
# 安装mongo扩展时,出现如下错误:
# Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/mongo.so'
# 需要先安装libssl-dev
# 如果本地构建的话,建议先下载好相应的扩展包
# 直接使用pecl install msgpack会报错:
# Failed to download pecl/msgpack within preferred state "stable", latest release is version 0.5.7, stability "beta", use "channel://pecl.php.net/msgpack-0.5.7" to install
# 注意:msgpack 2.0.0需要php7
#&& pecl install msgpack-beta \
#&& pecl install mongo \
#&& echo "extension=mongo.so" > /usr/local/etc/php/conf.d/mongo.ini \
# 2016-05-25 基础镜像与扩展镜像分离
# iconv tokenizer pdo mbstring: 已经包含在基础镜像里
# mysqli, mysql: 都转移到ibbd/php-fpm-ext镜像
# gd库转移到ibbd/php-fpm-ext镜像
# memcache, imagick, mysqli, mysql扩展转移到ibbd/php-fpm-ext库
#RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
#&& docker-php-ext-install gd \
#&& docker-php-ext-install mcrypt mysqli mysql zip \
RUN docker-php-ext-install mcrypt mysqli mysql pdo_mysql zip \
&& pecl install redis \
&& echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini \
&& pecl install channel://pecl.php.net/msgpack-0.5.7 \
&& echo "extension=msgpack.so" > /usr/local/etc/php/conf.d/msgpack.ini \
&& pecl install mongodb \
&& echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/mongodb.ini \
&& pecl install mongo \
&& echo "extension=mongo.so" > /usr/local/etc/php/conf.d/mongo.ini \
&& pecl clear-cache
# composer
# composer中国镜像
# 注意:需要先安装lumen,在安装laravel,否则报错
# 不应在镜像中绑定国内的镜像,因为镜像可能会用到国外的服务器
# 测试国内的容易抽风。。
#&& curl -sS https://getcomposer.org/installer -o /composer.php \
#&& php composer.php \
#&& mv composer.phar /usr/local/bin/composer \
#&& composer config -g repo.packagist composer http://packagist.phpcomposer.com \
#&& rm -f composer.php \
#&& chmod 755 /usr/local/bin/composer \
#&& php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === 'fd26ce67e3b237fffd5e5544b45b0d92c41a4afe3e3f778e942e43ce6be197b9cdc7c251dcde6e2a52297ea269370680') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); }" \
RUN cd / \
&& php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php \
&& php composer-setup.php --filename=composer --install-dir=/usr/local/bin/ \
&& rm composer-setup.php \
&& composer global require "laravel/lumen-installer" \
&& composer global require "laravel/installer" \
&& composer clearcache \
&& composer clear-cache
# 解决时区问题
ENV TZ "Asia/Shanghai"
# 终端设置
# 执行php-fpm时,默认值是dumb,这时在终端操作时可能会出现:terminal is not fully functional
ENV TERM xterm
# Define mountable directories.
VOLUME /var/www
# 工作目录
WORKDIR /var/www
EXPOSE 9000