mirror of
https://github.com/opdavies/build-configs.git
synced 2025-01-22 18:27:31 +00:00
Add Apache support to Drupal
This commit is contained in:
parent
2f6673d941
commit
3065597f64
4
justfile
4
justfile
|
@ -11,8 +11,8 @@ build:
|
|||
|
||||
composer dump-env prod
|
||||
|
||||
./build-configs cache:clear
|
||||
./build-configs cache:warmup
|
||||
./bin/build-configs cache:clear
|
||||
./bin/build-configs cache:warmup
|
||||
|
||||
# Generate the phar file.
|
||||
box compile --config box.json.dist
|
||||
|
|
|
@ -113,6 +113,14 @@ final class CreateListOfFilesToGenerate
|
|||
path: 'tools/docker/images/php/root/usr/local/etc/php',
|
||||
));
|
||||
|
||||
if (static::isApache(Arr::get($configurationData, 'web.type'))) {
|
||||
$filesToGenerate[] = new TemplateFile(
|
||||
data: 'php/drupal/apache/000-default.conf',
|
||||
name: '000-default.conf',
|
||||
path: 'tools/docker/images/php/root/etc/apache2/sites-available',
|
||||
);
|
||||
}
|
||||
|
||||
if (static::isCaddy(Arr::get($configurationData, 'web.type'))) {
|
||||
$filesToGenerate[] = new TemplateFile(
|
||||
data: 'php/drupal/caddy/Caddyfile',
|
||||
|
@ -170,6 +178,15 @@ final class CreateListOfFilesToGenerate
|
|||
return $next([$configurationData, $configDto, $filesToGenerate]);
|
||||
}
|
||||
|
||||
private static function isApache(?string $webServer): bool
|
||||
{
|
||||
if (is_null($webServer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $webServer === WebServer::Apache->value;
|
||||
}
|
||||
|
||||
private static function isCaddy(?string $webServer): bool
|
||||
{
|
||||
if (is_null($webServer)) {
|
||||
|
|
|
@ -251,7 +251,7 @@ final class ConfigDto
|
|||
|
||||
#[Assert\Collection([
|
||||
'type' => new Assert\Required([
|
||||
new Assert\Choice(choices: ['nginx', 'caddy']),
|
||||
new Assert\Choice(choices: ['apache', 'caddy', 'nginx']),
|
||||
]),
|
||||
])]
|
||||
public array $web;
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace App\Enum;
|
|||
|
||||
enum WebServer: string
|
||||
{
|
||||
case Apache = 'apache';
|
||||
case Caddy = 'caddy';
|
||||
case Nginx = 'nginx';
|
||||
}
|
||||
|
|
|
@ -65,7 +65,11 @@ RUN {{ command }}
|
|||
COPY --chown=app:app tools/docker/images/php/root /
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-php"]
|
||||
{% if web.type == "apache" %}
|
||||
CMD ["apache2-foreground"]
|
||||
{% else %}
|
||||
CMD ["php-fpm"]
|
||||
{% endif %}
|
||||
|
||||
{% if dockerfile.stages.test %}
|
||||
################################################################################
|
||||
|
|
8
templates/php/drupal/apache/000-default.conf.twig
Normal file
8
templates/php/drupal/apache/000-default.conf.twig
Normal file
|
@ -0,0 +1,8 @@
|
|||
# {{ managedText|raw }}
|
||||
|
||||
<VirtualHost *:80>
|
||||
DocumentRoot /var/www/html/{{ drupal.docroot }}
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
2
vendor-bin/box/composer.lock
generated
2
vendor-bin/box/composer.lock
generated
|
@ -3100,5 +3100,5 @@
|
|||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue