diff --git a/src/Console/Command/BuildConfigurationCommand.php b/src/Console/Command/BuildConfigurationCommand.php index 431d299..1c15a1a 100644 --- a/src/Console/Command/BuildConfigurationCommand.php +++ b/src/Console/Command/BuildConfigurationCommand.php @@ -60,6 +60,10 @@ final class BuildConfigurationCommand extends Command $this->filesystem->dumpFile("{$outputDir}/phpcs.xml.dist", $this->twig->render('phpcs.xml.twig', $configurationData)); $this->filesystem->dumpFile("{$outputDir}/phpstan.neon.dist", $this->twig->render('phpstan.neon.twig', $configurationData)); $this->filesystem->dumpFile("{$outputDir}/phpunit.xml.dist", $this->twig->render('phpunit.xml.twig', $configurationData)); + + $this->filesystem->mkdir("{$outputDir}/tools/docker/images/php/root/usr/local/bin"); + $this->filesystem->dumpFile("{$outputDir}/tools/docker/images/php/root/usr/local/bin/docker-entrypoint-php", $this->twig->render('docker-entrypoint-php.twig', $configurationData)); + } } return Command::SUCCESS; diff --git a/templates/Dockerfile.twig b/templates/Dockerfile.twig index 0d6419b..dca83e7 100644 --- a/templates/Dockerfile.twig +++ b/templates/Dockerfile.twig @@ -32,6 +32,11 @@ RUN {% for command in dockerfile.stages.build.commands %} {% endfor %} {% endif %} +COPY tools/docker/images/php/root / + +ENTRYPOINT ["/usr/local/bin/docker-entrypoint-php"] +CMD ["php-fpm"] + {% if dockerfile.stages.test %} ################################################################################ diff --git a/templates/docker-entrypoint-php.twig b/templates/docker-entrypoint-php.twig new file mode 100755 index 0000000..564778b --- /dev/null +++ b/templates/docker-entrypoint-php.twig @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +[[ -f composer.json && ! -d vendor ]] && composer install + +eval "$@"