From 249b8a476843d7e6fc4e507e1f1762222084aeb1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 24 Feb 2019 13:22:44 +0100 Subject: [PATCH] Added config to reload swoole during development --- composer.json | 2 +- config/autoload/swoole.local.php.dist | 21 +++++++++++++++++++++ data/infra/swoole.Dockerfile | 11 +++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 config/autoload/swoole.local.php.dist diff --git a/composer.json b/composer.json index bd00a90a..cc61db95 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "zendframework/zend-expressive-fastroute": "^3.0", "zendframework/zend-expressive-helpers": "^5.0", "zendframework/zend-expressive-platesrenderer": "^2.0", - "zendframework/zend-expressive-swoole": "^2.2", + "zendframework/zend-expressive-swoole": "^2.3", "zendframework/zend-i18n": "^2.7", "zendframework/zend-inputfilter": "^2.8", "zendframework/zend-paginator": "^2.6", diff --git a/config/autoload/swoole.local.php.dist b/config/autoload/swoole.local.php.dist new file mode 100644 index 00000000..017d17eb --- /dev/null +++ b/config/autoload/swoole.local.php.dist @@ -0,0 +1,21 @@ + [ + 'hot-code-reload' => [ + 'enable' => true, + ], + ], + + 'dependencies' => [ + 'factories' => [ + InotifyFileWatcher::class => InvokableFactory::class, + ], + ], + +]; diff --git a/data/infra/swoole.Dockerfile b/data/infra/swoole.Dockerfile index 1695e82c..6b647a42 100644 --- a/data/infra/swoole.Dockerfile +++ b/data/infra/swoole.Dockerfile @@ -5,6 +5,7 @@ ENV PREDIS_VERSION 4.2.0 ENV MEMCACHED_VERSION 3.1.3 ENV APCU_VERSION 5.1.16 ENV APCU_BC_VERSION 1.0.4 +ENV INOTIFY_VERSION 2.0.0 RUN apk update @@ -76,6 +77,16 @@ RUN rm /tmp/apcu_bc.tar.gz RUN rm /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini RUN echo extension=apcu.so > /usr/local/etc/php/conf.d/20-php-ext-apcu.ini +# Install inotify extension +ADD https://pecl.php.net/get/inotify-$INOTIFY_VERSION.tgz /tmp/inotify.tar.gz +RUN mkdir -p /usr/src/php/ext/inotify\ + && tar xf /tmp/inotify.tar.gz -C /usr/src/php/ext/inotify --strip-components=1 +# configure and install +RUN docker-php-ext-configure inotify\ + && docker-php-ext-install inotify +# cleanup +RUN rm /tmp/inotify.tar.gz + # Install swoole # First line fixes an error when installing pecl extensions. Found in https://github.com/docker-library/php/issues/233 RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS && \