diff --git a/Dockerfile b/Dockerfile index 5b317cd003..418e8e812d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,11 @@ RUN apt-get update \ xpdf \ && update-locale "LANG=fr_FR.UTF-8 UTF-8" \ && dpkg-reconfigure --frontend noninteractive locales \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ + && docker-php-source extract \ && docker-php-ext-install -j$(nproc) gd \ && docker-php-ext-install zip exif iconv mbstring pcntl sockets xsl intl pdo_mysql gettext bcmath mcrypt \ && pecl install redis amqp-1.9.3 zmq-beta imagick-beta \ @@ -126,6 +130,12 @@ RUN mkdir -p /var/alchemy/Phraseanet/logs \ FROM phraseanet-system as phraseanet-fpm +RUN docker-php-source extract \ + && pecl install xdebug-2.9.0 \ + && docker-php-ext-enable xdebug \ + #&& pecl clear-cache \ + && docker-php-source delete + COPY --from=builder --chown=app /var/alchemy /var/alchemy/Phraseanet ADD ./docker/phraseanet/ / WORKDIR /var/alchemy/Phraseanet diff --git a/docker/phraseanet/boot.sh b/docker/phraseanet/boot.sh index 444b63a64c..578da3a8da 100755 --- a/docker/phraseanet/boot.sh +++ b/docker/phraseanet/boot.sh @@ -14,4 +14,4 @@ else runuser app -c '/auto-install.sh' fi -php-fpm +php-fpm -F diff --git a/docker/phraseanet/phraseanet-entrypoint.sh b/docker/phraseanet/phraseanet-entrypoint.sh index 225b56a672..3040718c11 100755 --- a/docker/phraseanet/phraseanet-entrypoint.sh +++ b/docker/phraseanet/phraseanet-entrypoint.sh @@ -4,5 +4,16 @@ set -e envsubst < /php.ini.sample > /usr/local/etc/php/php.ini envsubst < /php-fpm.conf.sample > /usr/local/etc/php-fpm.conf +echo "XDEBUG=$XDEBUG" +if [ $XDEBUG = "ON" ]; then + echo "XDEBUG IS ENABLED. YOU MAY KEEP THIS FEATURE DISABLED IN PRODUCTION." + echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_host=$XDEBUG_SERVER" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_port=$XDEBUG_REMOTE_PORT" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + #echo "xdebug.idekey=11896" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +fi bash -e docker-php-entrypoint $@ diff --git a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php index 890fed9e6d..112914d088 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php +++ b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php @@ -15,6 +15,7 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Command\Command; use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Model\Entities\User; +use Alchemy\Phrasea\Plugin\Plugin; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\HttpKernel\Client; @@ -30,6 +31,15 @@ class JsFixtures extends Command protected function doExecute(InputInterface $input, OutputInterface $output) { + /** @var Plugin $plugin */ + $msg = []; + foreach($this->container['plugins.manager']->listPlugins() as $plugin) { + $msg[] = sprintf(" bin/setup plugins:remove \"%s\"", $plugin->getName()); + } + if(count($msg) !== 0) { + throw new RuntimeException("You must remove plugins first:\n" . join("\n", $msg)); + } + if (!file_exists($this->container['db.fixture.info']['path'])) { throw new RuntimeException('You must generate sqlite db first, run "bin/developer phraseanet:regenerate-sqlite" command.'); } @@ -104,6 +114,7 @@ class JsFixtures extends Command private function writeResponse(OutputInterface $output, $method, $path, $to, $authenticateUser = false) { $environment = Application::ENV_TEST; + /** @var Application $app */ $app = require __DIR__ . '/../../Application/Root.php'; $app['orm.em'] = $app->extend('orm.em', function($em, $app) { return $app['orm.ems'][$app['db.fixture.hash.key']];