diff --git a/README.md b/README.md index 358beee..c8c4e62 100644 --- a/README.md +++ b/README.md @@ -282,29 +282,37 @@ By default **PHP 7.0** is running.
To change the default PHP version: -1 - Open the `dockerfile` of the `php` folder. +1 - Open the `docker-compose.yml`. -2 - Change the PHP version number in the first line, +2 - Search for `Dockerfile-php-70` in the PHP container section. + +3 - Change the version number. +
+Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-php-70` with `Dockerfile-php-56`. + +Sample: ```txt -FROM php:7.0-fpm +php: + build: + context: ./php + dockerfile: Dockerfile-php-70 ``` Supported Versions: -- For (PHP 7.0.*) use `php:7.0-fpm` -- For (PHP 5.6.*) use `php:5.6-fpm` -- For (PHP 5.5.*) use `php:5.5-fpm` +- For (PHP 7.0.*) use `Dockerfile-php-70` +- For (PHP 5.6.*) use `Dockerfile-php-56` +- For (PHP 5.5.*) use `Dockerfile-php-55` -For more details visit the [official PHP docker images](https://hub.docker.com/_/php/). -3 - Finally rebuild the container +4 - Finally rebuild the container ```bash docker-compose build php ``` - +For more details visit the [official PHP docker images](https://hub.docker.com/_/php/).
diff --git a/docker-compose.yml b/docker-compose.yml index af36bce..549458d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,9 @@ services: ### PHP Container ########################################### php: - build: ./php + build: + context: ./php + dockerfile: Dockerfile-php-70 volumes: - ../:/var/www/laravel - ./logs/php/:/usr/local/var/log diff --git a/php/Dockerfile-php-55 b/php/Dockerfile-php-55 new file mode 100644 index 0000000..b8f69b2 --- /dev/null +++ b/php/Dockerfile-php-55 @@ -0,0 +1,23 @@ +FROM php:5.5-fpm + +MAINTAINER Mahmoud Zalt + +ADD ./laravel.ini /usr/local/etc/php/conf.d +ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ + +RUN apt-get update && apt-get install \ + libpq-dev -y \ + curl + +# Install extensions using the helper script provided by the base image +RUN docker-php-ext-install \ + pdo_mysql \ + pdo_pgsql + +RUN usermod -u 1000 www-data + +WORKDIR /var/www/laravel + +CMD ["php-fpm"] + +EXPOSE 9000 diff --git a/php/Dockerfile-php-56 b/php/Dockerfile-php-56 new file mode 100644 index 0000000..b43fe41 --- /dev/null +++ b/php/Dockerfile-php-56 @@ -0,0 +1,23 @@ +FROM php:5.6-fpm + +MAINTAINER Mahmoud Zalt + +ADD ./laravel.ini /usr/local/etc/php/conf.d +ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ + +RUN apt-get update && apt-get install \ + libpq-dev -y \ + curl + +# Install extensions using the helper script provided by the base image +RUN docker-php-ext-install \ + pdo_mysql \ + pdo_pgsql + +RUN usermod -u 1000 www-data + +WORKDIR /var/www/laravel + +CMD ["php-fpm"] + +EXPOSE 9000 diff --git a/php/Dockerfile b/php/Dockerfile-php-70 similarity index 84% rename from php/Dockerfile rename to php/Dockerfile-php-70 index 0f9635c..e6b3416 100644 --- a/php/Dockerfile +++ b/php/Dockerfile-php-70 @@ -1,5 +1,4 @@ -# You can change the PHP version from here. After changing the PHP version, check the Memcached section below because it replies on PHP 7. -FROM php:7.0-fpm +FROM php:7.0-fpm MAINTAINER Mahmoud Zalt