@@ -200,10 +200,12 @@ public function build(Config $config): Manager
200200
201201 $ volumePrefix = $ config ->getNameWithPrefix ();
202202
203- $ manager ->addVolume (
204- $ volumePrefix . self ::VOLUME_MARIADB_CONF ,
205- $ this ->getVolumeConfig ('/.docker/mysql/mariadb.conf.d ' )
206- );
203+ if ($ config ->hasMariaDbConf ()) {
204+ $ manager ->addVolume (
205+ $ volumePrefix . self ::VOLUME_MARIADB_CONF ,
206+ $ this ->getVolumeConfig ('/.docker/mysql/mariadb.conf.d ' )
207+ );
208+ }
207209
208210 $ this ->addDbService ($ manager , $ config , self ::SERVICE_DB , $ dbVersion , $ volumesMount );
209211
@@ -471,6 +473,9 @@ public function getPath(): string
471473 * @param Config $config
472474 * @throws ConfigurationMismatchException
473475 * @throws GenericException
476+ *
477+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
478+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
474479 */
475480 private function addDbService (
476481 Manager $ manager ,
@@ -480,21 +485,29 @@ private function addDbService(
480485 array $ mounts
481486 ): void {
482487 $ volumePrefix = $ config ->getNameWithPrefix ();
483- $ mounts [] = $ volumePrefix . self ::VOLUME_MARIADB_CONF . ':/etc/mysql/mariadb.conf.d ' ;
488+
489+ if ($ config ->hasMariaDbConf ()) {
490+ $ mounts [] = $ volumePrefix . self ::VOLUME_MARIADB_CONF . ':/etc/mysql/mariadb.conf.d ' ;
491+ }
492+
484493 $ commands = [];
485494
486495 switch ($ service ) {
487496 case self ::SERVICE_DB :
488497 $ port = $ config ->getDbPortsExpose ();
489498
490499 $ manager ->addVolume ($ volumePrefix . self ::VOLUME_MAGENTO_DB , []);
491- $ manager ->addVolume (
492- self ::VOLUME_DOCKER_ETRYPOINT ,
493- $ this ->getVolumeConfig ('/.docker/mysql/docker-entrypoint-initdb.d ' )
494- );
495500
496501 $ mounts [] = $ volumePrefix . self ::VOLUME_MAGENTO_DB . ':/var/lib/mysql ' ;
497- $ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT . ':/docker-entrypoint-initdb.d ' ;
502+
503+ if ($ config ->hasDbEntrypoint ()) {
504+ $ manager ->addVolume (
505+ self ::VOLUME_DOCKER_ETRYPOINT ,
506+ $ this ->getVolumeConfig ('/.docker/mysql/docker-entrypoint-initdb.d ' )
507+ );
508+ $ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT . ':/docker-entrypoint-initdb.d ' ;
509+ }
510+
498511 $ serviceType = ServiceInterface::SERVICE_DB ;
499512
500513 if ($ config ->getDbIncrementIncrement () > 1 ) {
@@ -541,11 +554,11 @@ private function addDbService(
541554 $ dbConfig = [
542555 'ports ' => [$ port ? "$ port:3306 " : '3306 ' ],
543556 'volumes ' => $ mounts ,
544- self ::SERVICE_HEALTHCHECK => [
545- 'test ' => 'mysqladmin ping -h localhost ' ,
546- 'interval ' => '30s ' ,
547- 'timeout ' => '30s ' ,
548- 'retries ' => 3
557+ self ::SERVICE_HEALTHCHECK => [
558+ 'test ' => 'mysqladmin ping -h localhost ' ,
559+ 'interval ' => '30s ' ,
560+ 'timeout ' => '30s ' ,
561+ 'retries ' => 3
549562 ],
550563 ];
551564
@@ -576,12 +589,14 @@ private function getServiceConfig(string $service, Config $config): array
576589 {
577590 switch ($ service ) {
578591 case self ::SERVICE_REDIS :
579- $ serviceConfig = [self ::SERVICE_HEALTHCHECK => [
580- 'test ' => 'redis-cli ping || exit 1 ' ,
581- 'interval ' => '30s ' ,
582- 'timeout ' => '30s ' ,
583- 'retries ' => 3
584- ]];
592+ $ serviceConfig = [
593+ self ::SERVICE_HEALTHCHECK => [
594+ 'test ' => 'redis-cli ping || exit 1 ' ,
595+ 'interval ' => '30s ' ,
596+ 'timeout ' => '30s ' ,
597+ 'retries ' => 3
598+ ]
599+ ];
585600 break ;
586601
587602 case self ::SERVICE_ELASTICSEARCH :
0 commit comments