-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile
64 lines (55 loc) · 2.47 KB
/
Dockerfile
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
FROM php:5-fpm-alpine
MAINTAINER HelloMJW majinawei168@outlook.com
#替换国内镜像
COPY ./source.list /etc/apk/repositories
RUN apk update && apk upgrade
#时区配置
ENV TIMEZONE Asia/Shanghai
RUN apk add tzdata git ansible && ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime && echo $TIMEZONE > /etc/timezone
RUN docker-php-ext-install mbstring opcache pdo pdo_mysql mysql mysqli
#添加扩展 gd zip
RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
docker-php-ext-configure gd \
--with-gd \
--with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ \
--with-zlib-dir=/usr && \
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
docker-php-ext-install -j${NPROC} gd zip && \
apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev
#添加redis
#ENV PHPREDIS_VERSION 3.1.3
#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 \
# && mkdir -p /usr/src/php/ext \
# && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis \
# && docker-php-ext-install redis \
# && rm -rf /usr/src/php
#添加memcached
ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev
RUN apk add --no-cache --update libmemcached-libs zlib
RUN set -xe \
&& apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS \
&& apk add --no-cache --update --virtual .memcached-deps $MEMCACHED_DEPS \
&& pecl install memcached-2.2.0 \
&& echo "extension=memcached.so" > /usr/local/etc/php/conf.d/memcached.ini \
&& pecl install redis \
&& echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini \
&& rm -rf /usr/share/php \
&& rm -rf /tmp/* \
&& apk del .memcached-deps .phpize-deps
#ENV PHPMEMCACHED_VERSION 1.5.1
#RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS libz-dev \
# && pecl install -o -f memcached-2.2.0 \
# && echo extension=memcached.so >> /usr/local/etc/php/conf.d/memcached.ini \
# && apk del .build-deps \
# && pecl update-channels \
# && rm -rf /tmp/pear ~/.pearrc
#安装php composer
RUN php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" && \
php composer-setup.php && \
php -r "unlink('composer-setup.php');" && \
mv composer.phar /usr/local/bin/composer
WORKDIR /home/www-data