Commit 101986c7 authored by Mahmoud Zalt's avatar Mahmoud Zalt

merge the php versions dockerfiles in php-fpm, workspace and php-worker

parent add78a19
...@@ -215,28 +215,24 @@ The PHP-CLI extensions should be installed in `workspace/Dockerfile`. ...@@ -215,28 +215,24 @@ The PHP-CLI extensions should be installed in `workspace/Dockerfile`.
<br> <br>
<a name="Change-the-PHP-FPM-Version"></a> <a name="Change-the-PHP-FPM-Version"></a>
## Change the (PHP-FPM) Version ## Change the (PHP-FPM) Version
By default **PHP-FPM 7.0** is running. By default the latest stable PHP versin is configured to run.
>The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planning to run your application on different PHP-FPM version. >The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planning to run your application on different PHP-FPM version.
### A) Switch from PHP `7.0` to PHP `5.6` ### A) Switch from PHP `7.2` to PHP `5.6`
1 - Open the `docker-compose.yml`. 1 - Open the `.env`.
2 - Search for `Dockerfile-70` in the PHP container section. 2 - Search for `PHP_VERSION`.
3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-56`, like this: 3 - Set the desired version number:
```yml ```dotenv
php-fpm: PHP_VERSION=5.6
build:
context: ./php-fpm
dockerfile: Dockerfile-56
...
``` ```
4 - Finally rebuild the container 4 - Finally rebuild the image
```bash ```bash
docker-compose build php-fpm docker-compose build php-fpm
...@@ -245,25 +241,6 @@ docker-compose build php-fpm ...@@ -245,25 +241,6 @@ docker-compose build php-fpm
> For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/). > For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
### B) Switch from PHP `7.0` or `5.6` to PHP `5.5`
We do not natively support PHP 5.5 anymore, but you can get it in few steps:
1 - Clone `https://github.com/laradock/php-fpm`.
3 - Rename `Dockerfile-56` to `Dockerfile-55`.
3 - Edit the file `FROM php:5.6-fpm` to `FROM php:5.5-fpm`.
4 - Build an image from `Dockerfile-55`.
5 - Open the `docker-compose.yml` file.
6 - Point `php-fpm` to your `Dockerfile-55` file.
<br> <br>
...@@ -273,11 +250,23 @@ By default **PHP-CLI 7.0** is running. ...@@ -273,11 +250,23 @@ By default **PHP-CLI 7.0** is running.
>Note: it's not very essential to edit the PHP-CLI version. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn't serve your Application code, this is the PHP-FPM job. >Note: it's not very essential to edit the PHP-CLI version. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn't serve your Application code, this is the PHP-FPM job.
The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to edit the `workspace/Dockerfile`. The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to simply change the `PHP_VERSION` in te .env file as follow:
1 - Open the `.env`.
Right now you have to manually edit the `Dockerfile` or create a new one like it's done for the PHP-FPM. (consider contributing). 2 - Search for `PHP_VERSION`.
3 - Set the desired version number:
```dotenv
PHP_VERSION=7.2
```
4 - Finally rebuild the image
```bash
docker-compose build workspace
```
...@@ -558,7 +547,6 @@ b) add a new service container by simply copy-paste this section below PHP-FPM c ...@@ -558,7 +547,6 @@ b) add a new service container by simply copy-paste this section below PHP-FPM c
php-worker: php-worker:
build: build:
context: ./php-worker context: ./php-worker
dockerfile: "Dockerfile-${PHP_VERSION}" #Dockerfile-71 or #Dockerfile-70 available
args: args:
- INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL} #Optionally install PGSQL PHP drivers - INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL} #Optionally install PGSQL PHP drivers
volumes_from: volumes_from:
......
...@@ -58,7 +58,7 @@ That's it! enjoy :) ...@@ -58,7 +58,7 @@ That's it! enjoy :)
<a name="features"></a> <a name="features"></a>
## Features ## Features
- Easy switch between PHP versions: 7.1, 7.0, 5.6... - Easy switch between PHP versions: 7.2, 7.1, 5.6...
- Choose your favorite database engine: MySQL, Postgres, MariaDB... - Choose your favorite database engine: MySQL, Postgres, MariaDB...
- Run your own combination of software: Memcached, HHVM, Beanstalkd... - Run your own combination of software: Memcached, HHVM, Beanstalkd...
- Every software runs on a separate container: PHP-FPM, NGINX, PHP-CLI... - Every software runs on a separate container: PHP-FPM, NGINX, PHP-CLI...
......
...@@ -2,15 +2,6 @@ version: '3' ...@@ -2,15 +2,6 @@ version: '3'
services: services:
### Applications Code Container #############################
# applications:
# image: tianon/true
# volumes:
# - applications-sync:/var/www:nocopy # nocopy is required
### Volumes Setup #############################################
volumes: volumes:
applications-sync: applications-sync:
external: external:
......
...@@ -47,6 +47,7 @@ services: ...@@ -47,6 +47,7 @@ services:
build: build:
context: ./workspace context: ./workspace
args: args:
- PHP_VERSION=${PHP_VERSION}
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG} - INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
- INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP} - INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP}
...@@ -88,7 +89,6 @@ services: ...@@ -88,7 +89,6 @@ services:
- TZ=${WORKSPACE_TIMEZONE} - TZ=${WORKSPACE_TIMEZONE}
- BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID} - BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID}
- BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN} - BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN}
dockerfile: "Dockerfile-${PHP_VERSION}"
volumes: volumes:
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER} - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
extra_hosts: extra_hosts:
...@@ -107,6 +107,7 @@ services: ...@@ -107,6 +107,7 @@ services:
build: build:
context: ./php-fpm context: ./php-fpm
args: args:
- PHP_VERSION=${PHP_VERSION}
- INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG} - INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
- INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP} - INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP}
...@@ -132,7 +133,6 @@ services: ...@@ -132,7 +133,6 @@ services:
- INSTALL_SWOOLE=${PHP_FPM_INSTALL_SWOOLE} - INSTALL_SWOOLE=${PHP_FPM_INSTALL_SWOOLE}
- INSTALL_IMAGE_OPTIMIZERS=${PHP_FPM_INSTALL_IMAGE_OPTIMIZERS} - INSTALL_IMAGE_OPTIMIZERS=${PHP_FPM_INSTALL_IMAGE_OPTIMIZERS}
- INSTALL_IMAGEMAGICK=${PHP_FPM_INSTALL_IMAGEMAGICK} - INSTALL_IMAGEMAGICK=${PHP_FPM_INSTALL_IMAGEMAGICK}
dockerfile: "Dockerfile-${PHP_VERSION}"
volumes: volumes:
- ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini - ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER} - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
...@@ -149,8 +149,8 @@ services: ...@@ -149,8 +149,8 @@ services:
php-worker: php-worker:
build: build:
context: ./php-worker context: ./php-worker
dockerfile: "Dockerfile-${PHP_VERSION}"
args: args:
- PHP_VERSION=${PHP_VERSION}
- INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL} - INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL}
volumes: volumes:
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER} - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
......
...@@ -31,8 +31,8 @@ COMPOSE_PATH_SEPARATOR=: ...@@ -31,8 +31,8 @@ COMPOSE_PATH_SEPARATOR=:
### PHP Version ########################################### ### PHP Version ###########################################
# Select a PHP version of the Workspace and PHP-FPM containers (Does not apply to HHVM). Accepted values: 72 - 71 - 70 - 56 # Select a PHP version of the Workspace and PHP-FPM containers (Does not apply to HHVM). Accepted values: 7.2 - 7.1 - 7.0 - 5.6 - 5.5
PHP_VERSION=72 PHP_VERSION=7.2
### PHP Interpreter ####################################### ### PHP Interpreter #######################################
...@@ -319,6 +319,11 @@ AEROSPIKE_FABRIC_PORT=3001 ...@@ -319,6 +319,11 @@ AEROSPIKE_FABRIC_PORT=3001
AEROSPIKE_HEARTBEAT_PORT=3002 AEROSPIKE_HEARTBEAT_PORT=3002
AEROSPIKE_INFO_PORT=3003 AEROSPIKE_INFO_PORT=3003
## Temp solution, this should be in the dockerfile
# for all versions "https://github.com/aerospike/aerospike-client-php/archive/master.tar.gz"
# for php 7.2 (using this branch until the support for 7.2 on master) "https://github.com/aerospike/aerospike-client-php/archive/7.2.0-in-progress.tar.gz"
AEROSPIKE_PHP_REPOSITORY=https://github.com/aerospike/aerospike-client-php/archive/7.2.0-in-progress.tar.gz
### RETHINKDB ############################################# ### RETHINKDB #############################################
RETHINKDB_PORT=8090 RETHINKDB_PORT=8090
...@@ -343,3 +348,7 @@ LARAVEL_ECHO_SERVER_PORT=6001 ...@@ -343,3 +348,7 @@ LARAVEL_ECHO_SERVER_PORT=6001
SOLR_VERSION=5.5 SOLR_VERSION=5.5
SOLR_PORT=8983 SOLR_PORT=8983
SOLR_DATAIMPORTHANDLER_MYSQL=false SOLR_DATAIMPORTHANDLER_MYSQL=false
### DRUSH_VERSION #########################################
DRUSH_VERSION=9.2.3
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# #
FROM php:7.2-alpine ARG PHP_VERSION=${PHP_VERSION}
FROM php:${PHP_VERSION}-alpine
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>" LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
...@@ -62,7 +63,7 @@ ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"] ...@@ -62,7 +63,7 @@ ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# #
RUN php -v | head -n 1 | grep -q "PHP 7.2." RUN php -v | head -n 1 | grep -q "PHP ${PHP_VERSION}."
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
......
#
#--------------------------------------------------------------------------
# Image Setup
#--------------------------------------------------------------------------
#
FROM php:7.0-alpine
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
RUN apk --update add wget \
curl \
git \
build-base \
libmemcached-dev \
libmcrypt-dev \
libxml2-dev \
zlib-dev \
autoconf \
cyrus-sasl-dev \
libgsasl-dev \
supervisor
RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql mcrypt tokenizer xml
RUN pecl channel-update pecl.php.net && pecl install memcached && docker-php-ext-enable memcached
# Install PostgreSQL drivers:
ARG INSTALL_PGSQL=false
RUN if [ ${INSTALL_PGSQL} = true ]; then \
apk --update add postgresql-dev \
&& docker-php-ext-install pdo_pgsql \
;fi
RUN rm /var/cache/apk/* \
&& mkdir -p /var/www
#
#--------------------------------------------------------------------------
# Optional Supervisord Configuration
#--------------------------------------------------------------------------
#
# Modify the ./supervisor.conf file to match your App's requirements.
# Make sure you rebuild your container with every change.
#
COPY supervisord.conf /etc/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
#
#--------------------------------------------------------------------------
# Optional Software's Installation
#--------------------------------------------------------------------------
#
# If you need to modify this image, feel free to do it right here.
#
# -- Your awesome modifications go here -- #
#
#--------------------------------------------------------------------------
# Check PHP version
#--------------------------------------------------------------------------
#
RUN php -v | head -n 1 | grep -q "PHP 7.0."
#
#--------------------------------------------------------------------------
# Final Touch
#--------------------------------------------------------------------------
#
WORKDIR /etc/supervisor/conf.d/
#
#--------------------------------------------------------------------------
# Image Setup
#--------------------------------------------------------------------------
#
FROM php:7.1-alpine
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
RUN apk --update add wget \
curl \
git \
build-base \
libmemcached-dev \
libmcrypt-dev \
libxml2-dev \
zlib-dev \
autoconf \
cyrus-sasl-dev \
libgsasl-dev \
supervisor
RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql mcrypt tokenizer xml
RUN pecl channel-update pecl.php.net && pecl install memcached && docker-php-ext-enable memcached
# Install PostgreSQL drivers:
ARG INSTALL_PGSQL=false
RUN if [ ${INSTALL_PGSQL} = true ]; then \
apk --update add postgresql-dev \
&& docker-php-ext-install pdo_pgsql \
;fi
RUN rm /var/cache/apk/* \
&& mkdir -p /var/www
#
#--------------------------------------------------------------------------
# Optional Supervisord Configuration
#--------------------------------------------------------------------------
#
# Modify the ./supervisor.conf file to match your App's requirements.
# Make sure you rebuild your container with every change.
#
COPY supervisord.conf /etc/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
#
#--------------------------------------------------------------------------
# Optional Software's Installation
#--------------------------------------------------------------------------
#
# If you need to modify this image, feel free to do it right here.
#
# -- Your awesome modifications go here -- #
#
#--------------------------------------------------------------------------
# Check PHP version
#--------------------------------------------------------------------------
#
RUN php -v | head -n 1 | grep -q "PHP 7.1."
#
#--------------------------------------------------------------------------
# Final Touch
#--------------------------------------------------------------------------
#
WORKDIR /etc/supervisor/conf.d/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment