Skip to content

Commit

Permalink
Merge pull request #67 from dreamfactorysoftware/php-version-update
Browse files Browse the repository at this point in the history
Update PHP from the version 7.1 to the version 7.2
  • Loading branch information
Taras Viyatyk authored Sep 11, 2019
2 parents ee2ed5a + baa2c66 commit a8412d7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
48 changes: 27 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends software-pro

RUN LANG=C.UTF-8 add-apt-repository ppa:ondrej/php -y && \
apt-get update && apt-get install -y --no-install-recommends --allow-unauthenticated \
git-core curl mcrypt nginx openssl python nodejs zip ssmtp wget php7.1-fpm php7.1-common \
php7.1-cli php7.1-curl php7.1-json php7.1-mcrypt php7.1-mysqlnd php7.1-pgsql php7.1-sqlite \
php-pear php7.1-dev php7.1-ldap php7.1-interbase php7.1-mbstring php7.1-bcmath php7.1-zip php7.1-soap php7.1-sybase php7.1-xml
bash git-core curl mcrypt nginx openssl python nodejs zip unzip ssmtp wget gcc make autoconf pkg-config libc-dev libmcrypt-dev \
php-pear php7.2-dev php7.2-fpm php7.2-common php7.2-cli php7.2-curl php7.2-json php7.2-mysqlnd php7.2-pgsql \
php7.2-ldap php7.2-interbase php7.2-mbstring php7.2-bcmath php7.2-zip php7.2-soap php7.2-sybase php7.2-xml php7.2-sqlite && \
pecl channel-update pecl.php.net

RUN apt-get install -y --allow-unauthenticated python-pip python3-pip pkg-config
RUN apt-get install -y --allow-unauthenticated python-pip python3-pip

RUN apt-get update && \
ln -s /usr/bin/nodejs /usr/bin/node && \
Expand All @@ -24,36 +25,41 @@ RUN apt-get update && \
apt-get update && \
ACCEPT_EULA=Y apt-get install -y --no-install-recommends mssql-tools unixodbc-dev && \
pecl install sqlsrv pdo_sqlsrv && \
echo "extension=sqlsrv.so" > /etc/php/7.1/mods-available/sqlsrv.ini && \
echo "extension=pdo_sqlsrv.so" > /etc/php/7.1/mods-available/pdo_sqlsrv.ini && \
echo "extension=sqlsrv.so" > /etc/php/7.2/mods-available/sqlsrv.ini && \
echo "extension=pdo_sqlsrv.so" > /etc/php/7.2/mods-available/pdo_sqlsrv.ini && \
phpenmod sqlsrv pdo_sqlsrv && \
pip install bunch && pip3 install munch && \
pecl install igbinary && \
echo "extension=igbinary.so" > /etc/php/7.1/mods-available/igbinary.ini && \
echo "extension=igbinary.so" > /etc/php/7.2/mods-available/igbinary.ini && \
phpenmod igbinary && \
pecl install mcrypt-1.0.2 && \
echo "extension=mcrypt.so" > /etc/php/7.2/mods-available/mcrypt.ini && \
phpenmod mcrypt && \
pecl install mongodb && \
echo "extension=mongodb.so" > /etc/php/7.1/mods-available/mongodb.ini && \
echo "extension=mongodb.so" > /etc/php/7.2/mods-available/mongodb.ini && \
phpenmod mongodb && \
git clone https://github.com/dreamfactorysoftware/v8-compiled.git /v8 && \
mkdir /opt/v8
WORKDIR /v8
# ubuntu_16.04/PHP7.1 folder is artifact after updating df-docker PHP from the 7.1 version to the 7.2 version.
# We should find how to compile these files special for PHP version 7.2.
RUN cp -R ubuntu_16.04/PHP7.1/* /opt/v8 && \
git clone https://github.com/phpv8/v8js.git /v8js
WORKDIR /v8js
RUN git checkout 1.3.6 && \
git pull origin 1.3.6 && \
RUN git checkout 1.4.1 && \
git pull origin 1.4.1 && \
phpize && \
./configure --with-v8js=/opt/v8 && \
make && make install && \
echo "extension=v8js.so" > /etc/php/7.1/mods-available/v8js.ini && \
echo "extension=v8js.so" > /etc/php/7.2/mods-available/v8js.ini && \
phpenmod v8js
WORKDIR /
RUN rm -Rf v8 && rm -Rf v8js

# install php cassandra extension
RUN mkdir /cassandra
WORKDIR /cassandra
RUN apt-get install -y --no-install-recommends libgmp-dev libpcre3-dev g++ make cmake libssl-dev && \
RUN apt-get install -y --no-install-recommends libgmp-dev libpcre3-dev g++ cmake libssl-dev && \
wget -q http://downloads.datastax.com/cpp-driver/ubuntu/16.04/dependencies/libuv/v1.11.0/libuv_1.11.0-1_amd64.deb && \
wget -q http://downloads.datastax.com/cpp-driver/ubuntu/16.04/dependencies/libuv/v1.11.0/libuv-dev_1.11.0-1_amd64.deb && \
wget -q http://downloads.datastax.com/cpp-driver/ubuntu/16.04/cassandra/v2.6.0/cassandra-cpp-driver_2.6.0-1_amd64.deb && \
Expand All @@ -69,7 +75,7 @@ WORKDIR /cassandra/php-driver/ext
RUN phpize && \
./configure && \
make && make install && \
echo "extension=cassandra.so" > /etc/php/7.1/mods-available/cassandra.ini && \
echo "extension=cassandra.so" > /etc/php/7.2/mods-available/cassandra.ini && \
phpenmod cassandra
WORKDIR /
RUN rm -Rf cassandra
Expand All @@ -83,14 +89,14 @@ RUN wget http://packages.couchbase.com/releases/couchbase-release/couchbase-rele
apt-get install -y --no-install-recommends --allow-unauthenticated libcouchbase-dev build-essential zlib1g-dev && \
pecl install pcs-1.3.3 && \
pecl install couchbase && \
echo "extension=pcs.so" > /etc/php/7.1/mods-available/pcs.ini && \
echo "extension=couchbase.so" > /etc/php/7.1/mods-available/xcouchbase.ini && \
echo "extension=pcs.so" > /etc/php/7.2/mods-available/pcs.ini && \
echo "extension=couchbase.so" > /etc/php/7.2/mods-available/xcouchbase.ini && \
phpenmod pcs && phpenmod xcouchbase
WORKDIR /
RUN rm -Rf couchbase

# configure sendmail
RUN echo 'sendmail_path = "/usr/sbin/ssmtp -t"' > /etc/php/7.1/cli/conf.d/mail.ini
RUN echo 'sendmail_path = "/usr/sbin/ssmtp -t"' > /etc/php/7.2/cli/conf.d/mail.ini

# install composer
RUN curl -sS https://getcomposer.org/installer | php && \
Expand All @@ -102,11 +108,11 @@ RUN curl -sS https://getcomposer.org/installer | php && \
RUN rm /etc/nginx/sites-enabled/default
ADD dreamfactory.conf /etc/nginx/sites-available/dreamfactory.conf
RUN ln -s /etc/nginx/sites-available/dreamfactory.conf /etc/nginx/sites-enabled/dreamfactory.conf && \
sed -i "s/pm.max_children = 5/pm.max_children = 5000/" /etc/php/7.1/fpm/pool.d/www.conf && \
sed -i "s/pm.start_servers = 2/pm.start_servers = 150/" /etc/php/7.1/fpm/pool.d/www.conf && \
sed -i "s/pm.min_spare_servers = 1/pm.min_spare_servers = 100/" /etc/php/7.1/fpm/pool.d/www.conf && \
sed -i "s/pm.max_spare_servers = 3/pm.max_spare_servers = 200/" /etc/php/7.1/fpm/pool.d/www.conf && \
sed -i "s/pm = dynamic/pm = ondemand/" /etc/php/7.1/fpm/pool.d/www.conf && \
sed -i "s/pm.max_children = 5/pm.max_children = 5000/" /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i "s/pm.start_servers = 2/pm.start_servers = 150/" /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i "s/pm.min_spare_servers = 1/pm.min_spare_servers = 100/" /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i "s/pm.max_spare_servers = 3/pm.max_spare_servers = 200/" /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i "s/pm = dynamic/pm = ondemand/" /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i "s/worker_connections 768;/worker_connections 2048;/" /etc/nginx/nginx.conf && \
sed -i "s/keepalive_timeout 65;/keepalive_timeout 10;/" /etc/nginx/nginx.conf

Expand Down
4 changes: 2 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ if [ -n "$SENDMAIL_DEFAULT_COMMAND" ]; then
sed -i "s/#SENDMAIL_DEFAULT_COMMAND=.*/SENDMAIL_DEFAULT_COMMAND=\"$(echo "$SENDMAIL_DEFAULT_COMMAND" | sed 's/\//\\\//g')\"/" .env
fi

# start php7.1-fpm
service php7.1-fpm start
# start php7.2-fpm
service php7.2-fpm start

# start nginx
exec /usr/sbin/nginx -g "daemon off;"
2 changes: 1 addition & 1 deletion dreamfactory.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
upstream php_handler {
server unix:/var/run/php/php7.1-fpm.sock;
server unix:/var/run/php/php7.2-fpm.sock;
#server 127.0.0.1:9000 backup;
}

Expand Down

0 comments on commit a8412d7

Please sign in to comment.