|
| 1 | +FROM ubuntu:14.04 |
| 2 | +# FROM debian:jessie |
| 3 | + |
| 4 | +MAINTAINER Yo-An Lin "yoanlin93@gmail.com" |
| 5 | + |
| 6 | +USER root |
| 7 | + |
| 8 | +ENV DEBIAN_FRONTEND noninteractive |
| 9 | + |
| 10 | +ENV PHP_VERSION 5.6 |
| 11 | + |
| 12 | +ENV PHP_SUBVERSION $PHP_VERSION.10 |
| 13 | + |
| 14 | +ENV PHPBREW_ROOT /root/.phpbrew |
| 15 | + |
| 16 | +ENV PHPBREW_HOME /root/.phpbrew |
| 17 | + |
| 18 | +ENV PHPBREW_PHP php-$PHP_VERSION.10 |
| 19 | + |
| 20 | +ENV PHPBREW_SET_PROMPT 1 |
| 21 | + |
| 22 | + |
| 23 | +# Remove default dash and replace it with bash |
| 24 | +RUN rm /bin/sh && ln -s /bin/bash /bin/sh |
| 25 | + |
| 26 | +RUN echo "Asia/Taipei" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata |
| 27 | + |
| 28 | +RUN perl -i.bak -pe "s/archive.ubuntu.com/free.nchc.org.tw/g" /etc/apt/sources.list |
| 29 | + |
| 30 | +RUN export DEBIAN_FRONTEND="noninteractive" \ |
| 31 | + && apt-get update \ |
| 32 | + && apt-get build-dep -y php5 \ |
| 33 | + && apt-get -qqy install php5 \ |
| 34 | + && apt-get -qqy install php5-dev \ |
| 35 | + && apt-get -qqy install php5-cli \ |
| 36 | + && apt-get -qqy install php-apc \ |
| 37 | + && apt-get -qqy install php-pear \ |
| 38 | + && apt-get -qqy install php5-curl \ |
| 39 | + && apt-get -qqy install php5-fpm \ |
| 40 | + && apt-get -qqy install php5-gd \ |
| 41 | + && apt-get -qqy install php5-mysql \ |
| 42 | + && apt-get -qqy install php5-xdebug \ |
| 43 | + && apt-get -qqy install autoconf automake curl build-essential libxslt1-dev re2c libxml2 libxml2-dev php5-cli bison libbz2-dev libreadline-dev \ |
| 44 | + && apt-get -qqy install libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev \ |
| 45 | + && apt-get -qqy install libssl-dev openssl \ |
| 46 | + && apt-get -qqy install gettext libgettextpo-dev libgettextpo0 \ |
| 47 | + && apt-get -qqy install libicu-dev \ |
| 48 | + && apt-get -qqy install libmhash-dev libmhash2 \ |
| 49 | + && apt-get -qqy install libmcrypt-dev libmcrypt4 \ |
| 50 | + && apt-get -qqy install mysql-server mysql-client libmysqlclient-dev libmysqld-dev \ |
| 51 | + && apt-get -qqy install ca-certificates \ |
| 52 | + && apt-get -qqy install libyaml-dev libyaml-0-2 \ |
| 53 | + && apt-get -qqy install libcurl4-gnutls-dev libexpat1-dev libz-dev librecode0 \ |
| 54 | + && apt-get -qqy install libpcre3-dev libpcre++-dev \ |
| 55 | + && apt-get -qqy install git \ |
| 56 | + && apt-get -qqy install wget \ |
| 57 | + && apt-get -qqy install curl \ |
| 58 | + && apt-get -qqy install ant ant-contrib sqlite3 \ |
| 59 | + && apt-get clean -y \ |
| 60 | + && apt-get autoclean -y \ |
| 61 | + && apt-get autoremove -y \ |
| 62 | + && rm -rf /var/lib/{apt,dpkg,cache,log}/ \ |
| 63 | + && rm -rf /var/lib/apt/lists/* |
| 64 | + |
| 65 | +# Install php tools |
| 66 | +RUN mkdir -p /usr/bin \ |
| 67 | + && wget -q -O /usr/bin/phpunit https://phar.phpunit.de/phpunit.phar && chmod +x /usr/bin/phpunit \ |
| 68 | + && wget -q -O /usr/bin/composer https://getcomposer.org/composer.phar && chmod +x /usr/bin/composer \ |
| 69 | + && wget -q -O /usr/bin/phpmd http://static.phpmd.org/php/latest/phpmd.phar && chmod +x /usr/bin/phpmd \ |
| 70 | + && wget -q -O /usr/bin/sami http://get.sensiolabs.org/sami.phar && chmod +x /usr/bin/sami \ |
| 71 | + && wget -q -O /usr/bin/phpcov https://phar.phpunit.de/phpcov.phar && chmod +x /usr/bin/phpcov \ |
| 72 | + && wget -q -O /usr/bin/phpcpd https://phar.phpunit.de/phpcpd.phar && chmod +x /usr/bin/phpcpd \ |
| 73 | + && wget -q -O /usr/bin/phploc https://phar.phpunit.de/phploc.phar && chmod +x /usr/bin/phploc \ |
| 74 | + && wget -q -O /usr/bin/phptok https://phar.phpunit.de/phptok.phar && chmod +x /usr/bin/phptok \ |
| 75 | + && wget -q -O /usr/bin/box https://github.com/box-project/box2/releases/download/2.5.2/box-2.5.2.phar && chmod +x /usr/bin/box \ |
| 76 | + && wget -q -O /usr/bin/phpbrew https://github.com/phpbrew/phpbrew/raw/master/phpbrew && chmod +x /usr/bin/phpbrew |
| 77 | + |
| 78 | +SHELL ["/bin/bash", "-c"] |
| 79 | + |
| 80 | +RUN phpbrew init \ |
| 81 | + && echo 'source $HOME/.phpbrew/bashrc' >> /root/.bashrc \ |
| 82 | + && source ~/.phpbrew/bashrc \ |
| 83 | + && phpbrew install $PHP_SUBVERSION \ |
| 84 | + +default +bcmath +bz2 +calendar +cli +ctype +dom +fileinfo +filter +json \ |
| 85 | + +mbregex +mbstring +mhash +pcntl +pcre +pdo +phar +posix +readline +sockets \ |
| 86 | + +tokenizer +xml +curl +zip +openssl=yes +icu +opcache +fpm +sqlite +mysql +icu +default +intl +gettext |
| 87 | + |
| 88 | +RUN phpbrew ext install yaml -- --with-yaml=/usr/lib/x86_64-linux-gnu \ |
| 89 | + && phpbrew ext install gd -- --with-png-dir=/opt/local --with-jpeg-dir=/opt/local --with-freetype-dir=/opt/local --enable-gd-native-ttf \ |
| 90 | + && phpbrew ext install github:c9s/cssmin \ |
| 91 | + && phpbrew ext install github:sqmk/pecl-jsmin \ |
| 92 | + && phpbrew ext install github:c9s/php-fileutil \ |
| 93 | + && phpbrew ext install xdebug latest \ |
| 94 | + && phpbrew ext install apcu latest |
| 95 | + |
| 96 | +RUN echo "Asia/Taipei" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata |
| 97 | + |
| 98 | +COPY php.ini $PHPBREW_ROOT/php/php-$PHP_SUBVERSION/etc/php.ini |
| 99 | + |
| 100 | +VOLUME /home/ubuntu |
| 101 | +WORKDIR /home/ubuntu |
| 102 | + |
| 103 | +COPY build.sh /home/ubuntu/build.sh |
| 104 | +ENTRYPOINT ["/home/ubuntu/build.sh"] |
0 commit comments