在docker的php环境中安装rar扩展

linux下如何安装rar扩展参考:http://www.884358.com/php-rar/

dockerfile文件如下(红色部分为安装rar扩展增加的内容):

FROM daocloud.io/ubuntu:trusty
MAINTAINER Fernando Mayo <fernando@tutum.co>, Feng Honglin <hfeng@tutum.co>

RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Install packages
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install supervisor git apache2 libapache2-mod-php5 mysql-server php5-mysql pwgen php-apc php5-mcrypt \
curl php5-gd php5-curl php-pear wget tar php5-dev && \
wget http://pecl.php.net/get/rar-3.0.2.tgz && \
gunzip rar-3.0.2.tgz && \
tar -xvf rar-3.0.2.tar && \
cd rar-3.0.2 && \
phpize && \
./configure && make && make install && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
apt-get -y remove vim-common && \
apt-get -y install vim && \
echo "ServerName localhost" >> /etc/apache2/apache2.conf && \
echo "extension=rar.so" >> /etc/php5/apache2/conf.d/rar.ini

# Add image configuration and scripts
ADD start-apache2.sh /start-apache2.sh
ADD start-mysqld.sh /start-mysqld.sh
ADD run.sh /run.sh
RUN chmod 755 /*.sh
ADD my.cnf /etc/mysql/conf.d/my.cnf
ADD supervisord-apache2.conf /etc/supervisor/conf.d/supervisord-apache2.conf
ADD supervisord-mysqld.conf /etc/supervisor/conf.d/supervisord-mysqld.conf

发表评论

邮箱地址不会被公开。 必填项已用*标注