@@ -82,12 +82,25 @@ protected function buildDockerCompose(array $services)
82
82
->all ();
83
83
}
84
84
85
+ // Update the dependencies if the MariaDB service is used...
86
+ if (in_array ('mariadb10 ' , $ services ) || in_array ('mariadb11 ' , $ services )) {
87
+ $ compose ['services ' ]['laravel.test ' ]['depends_on ' ] = array_map (function ($ dependedItem ) {
88
+ if (in_array ($ dependedItem , ['mariadb10 ' , 'mariadb11 ' ])) {
89
+ return 'mariadb ' ;
90
+ }
91
+
92
+ return $ dependedItem ;
93
+ }, $ compose ['services ' ]['laravel.test ' ]['depends_on ' ]);
94
+ }
95
+
85
96
// Add the services to the docker-compose.yml...
86
97
collect ($ services )
87
98
->filter (function ($ service ) use ($ compose ) {
88
99
return ! array_key_exists ($ service , $ compose ['services ' ] ?? []);
89
100
})->each (function ($ service ) use (&$ compose ) {
90
- $ compose ['services ' ][$ service ] = Yaml::parseFile (__DIR__ . "/../../../stubs/ {$ service }.stub " )[$ service ];
101
+ in_array ($ service , ['mariadb10 ' , 'mariadb11 ' ])
102
+ ? $ compose ['services ' ]['mariadb ' ] = Yaml::parseFile (__DIR__ . "/../../../stubs/ {$ service }.stub " )['mariadb ' ]
103
+ : $ compose ['services ' ][$ service ] = Yaml::parseFile (__DIR__ . "/../../../stubs/ {$ service }.stub " )[$ service ];
91
104
});
92
105
93
106
// Merge volumes...
@@ -97,6 +110,10 @@ protected function buildDockerCompose(array $services)
97
110
})->filter (function ($ service ) use ($ compose ) {
98
111
return ! array_key_exists ($ service , $ compose ['volumes ' ] ?? []);
99
112
})->each (function ($ service ) use (&$ compose ) {
113
+ if (in_array ($ service , ['mariadb10 ' , 'mariadb11 ' ])) {
114
+ $ service = 'mariadb ' ;
115
+ }
116
+
100
117
$ compose ['volumes ' ]["sail- {$ service }" ] = ['driver ' => 'local ' ];
101
118
});
102
119
0 commit comments