Skip to content

Commit

Permalink
Merge pull request #131 from sumocoders/332-docker-config
Browse files Browse the repository at this point in the history
332 docker config
  • Loading branch information
tijsverkoyen authored Sep 17, 2024
2 parents 312f581 + 387a68a commit 9d2ac8f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- ~/Sites/sumocoders/docker/mariadb:/var/lib/mysql
40 changes: 40 additions & 0 deletions src/Skeleton/PostCreateProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,46 @@ 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);

$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
);
// 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);
}

private static function cleanup(Event $event): void
Expand Down

0 comments on commit 9d2ac8f

Please sign in to comment.