-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile-php56
78 lines (57 loc) · 2.88 KB
/
dockerfile-php56
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
# 基础镜像
FROM php:5.6-fpm-alpine
# 编写者
LABEL maintainer="[email protected]"
ENV LANG C.UTF-8
ENV TZ Asia/Shanghai
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk update \
# 系统时区设置
&& apk add --no-cache tzdata && ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >> /etc/timezone \
# 安装常用系统服务
&& apk add --no-cache wget vim gcc g++ automake autoconf make openssl-dev \
# 安装bash支持
&& apk add --no-cache bash bash-doc bash-completion && sed -i 's/ash/bash/g' /etc/passwd \
# 别名和环境设置
&& echo -e 'export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "\n \
export PS1="[\u@\h \W]# "\n \
alias wget="wget -U"\n \
alias ll="ls -alF"\n \
alias ls="ls --color=auto"\n \
source /etc/profile.d/bash_completion.sh\n' >> /root/.bashrc \
# php.ini
&& mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
# PHP.INI修改
&& sed -i "s#;date.timezone =#date.timezone = $TZ#g" $PHP_INI_DIR/php.ini \
&& sed -i "s#display_errors = Off#display_errors = On#g" $PHP_INI_DIR/php.ini \
&& sed -i "s#error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT#error_reporting = E_ERROR | E_WARNING | E_PARSE#g" $PHP_INI_DIR/php.ini \
&& sed -i "s#upload_max_filesize = 2M#upload_max_filesize = 100M#g" $PHP_INI_DIR/php.ini \
&& sed -i "s#post_max_size = 8M#post_max_size = 100M#g" $PHP_INI_DIR/php.ini \
&& sed -i "s#memory_limit = 128M#memory_limit = 512M#g" $PHP_INI_DIR/php.ini \
# composer
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& composer config -g repo.packagist composer https://mirrors.aliyun.com/composer \
# 安装php依赖的系统服务
&& apk add --no-cache libmcrypt-dev freetype-dev libjpeg-turbo-dev libpng-dev libzip-dev php-gd \
# 安装php扩展
&& docker-php-ext-install mcrypt bcmath zip mbstring mysqli pdo pdo_mysql mysql \
# GD库
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd \
# pecl安装
&& pecl install redis-3.1.6 && docker-php-ext-enable redis \
# xdebug2扩展
&& pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug \
&& echo -e '[xdebug] \n \
xdebug.auto_trace=On \n \
xdebug.profiler_enable=On \n \
xdebug.remote_enable=1 \n \
xdebug.remote_autostart=1 \n \
xdebug.remote_host="docker.for.mac.host.internal" \n \
xdebug.remote_port=9003 \n \
xdebug.remote_handler="dbgp" \n \
xdebug.idekey="PHPSTORM" \n' >> "$PHP_INI_DIR/php.ini" \
# 放在最后,删除安装文件
&& docker-php-source delete \
# 删除无用的文件,使镜像文件足够小
&& rm -rf /var/cache/apk/* && rm -rf /root/.cache && rm -rf /tmp/*
CMD ["php-fpm"]
WORKDIR /