From 75ade67c023767fa7308ee06f97a4cf166cdc8dd Mon Sep 17 00:00:00 2001 From: Tijs Verkoyen Date: Mon, 16 Sep 2024 13:54:36 +0200 Subject: [PATCH 1/4] Remove doctrine/doctrine-bundle configuration --- src/Skeleton/PostCreateProject.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Skeleton/PostCreateProject.php b/src/Skeleton/PostCreateProject.php index 0e68384..6c6c65d 100644 --- a/src/Skeleton/PostCreateProject.php +++ b/src/Skeleton/PostCreateProject.php @@ -560,6 +560,23 @@ private static function reconfigureApplication(Event $event): void PHP_EOL . implode(PHP_EOL, $insert) ); file_put_contents($projectDir . '/.env', $content); + + $io->notice('→ Reconfigure docker-compose.yml'); + $content = file_get_contents($projectDir . '/docker-compose.yml'); + // remove doctrine/doctrine-bundle configuration + $content = preg_replace( + '|###> doctrine/doctrine-bundle ###.*###< doctrine/doctrine-bundle ###|mUs', + '', + $content + ); + // remove empty volumes element + $content = preg_replace( + '|volumes:\n\n|mUs', + '', + $content + ); + $content = trim($content) . PHP_EOL; + file_put_contents($projectDir . '/docker-compose.yml', $content); } private static function cleanup(Event $event): void From a21151b013c72a72f5f263af1ed3a06eb9103ac5 Mon Sep 17 00:00:00 2001 From: Tijs Verkoyen Date: Mon, 16 Sep 2024 14:29:46 +0200 Subject: [PATCH 2/4] Don't expose docker environment variables from symfony server to our database service --- docker-compose.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6294c72..d7c028b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,5 +6,7 @@ services: ports: - 3306:3306 restart: always + labels: + com.symfony.server.service-ignore: true volumes: - - ~/Sites/sumocoders/docker/mariadb:/var/lib/mysql \ No newline at end of file + - ~/Sites/sumocoders/docker/mariadb:/var/lib/mysql From 149aa5c17411a3d39557ca1b1b4126e83715f943 Mon Sep 17 00:00:00 2001 From: Tijs Verkoyen Date: Mon, 16 Sep 2024 14:39:59 +0200 Subject: [PATCH 3/4] Remove doctrine/doctrine-bundle configuration from docker-compose.override.yml --- src/Skeleton/PostCreateProject.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Skeleton/PostCreateProject.php b/src/Skeleton/PostCreateProject.php index 6c6c65d..9f0820b 100644 --- a/src/Skeleton/PostCreateProject.php +++ b/src/Skeleton/PostCreateProject.php @@ -577,6 +577,17 @@ private static function reconfigureApplication(Event $event): void ); $content = trim($content) . PHP_EOL; file_put_contents($projectDir . '/docker-compose.yml', $content); + + $io->notice('→ Reconfigure docker-compose.override.yml'); + $content = file_get_contents($projectDir . '/docker-compose.override.yml'); + // remove doctrine/doctrine-bundle configuration + $content = preg_replace( + '|###> doctrine/doctrine-bundle ###.*###< doctrine/doctrine-bundle ###|mUs', + '', + $content + ); + $content = trim($content) . PHP_EOL; + file_put_contents($projectDir . '/docker-compose.override.yml', $content); } private static function cleanup(Event $event): void From 387a68ae1412e5eb68232c7e98111afab91599ac Mon Sep 17 00:00:00 2001 From: Tijs Verkoyen Date: Mon, 16 Sep 2024 14:40:24 +0200 Subject: [PATCH 4/4] Remove symfony/mailer configuration from docker-compose.override.yml --- src/Skeleton/PostCreateProject.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Skeleton/PostCreateProject.php b/src/Skeleton/PostCreateProject.php index 9f0820b..0aa627f 100644 --- a/src/Skeleton/PostCreateProject.php +++ b/src/Skeleton/PostCreateProject.php @@ -586,6 +586,18 @@ private static function reconfigureApplication(Event $event): void '', $content ); + // remove symfony/mailer configuration + $content = preg_replace( + '|###> symfony/mailer ###.*###< symfony/mailer ###|mUs', + '', + $content + ); + // remove empty volumes element + $content = preg_replace( + '|services:\n|mUs', + '', + $content + ); $content = trim($content) . PHP_EOL; file_put_contents($projectDir . '/docker-compose.override.yml', $content); }