@@ -90,11 +90,6 @@ class ProductionBuilder implements BuilderInterface
9090 */
9191 private $ managerFactory ;
9292
93- /**
94- * @var Resolver
95- */
96- private $ resolver ;
97-
9893 /**
9994 * @var VolumeResolver
10095 */
@@ -106,7 +101,6 @@ class ProductionBuilder implements BuilderInterface
106101 * @param Converter $converter
107102 * @param ExtensionResolver $phpExtension
108103 * @param ManagerFactory $managerFactory
109- * @param Resolver $resolver
110104 * @param VolumeResolver $volumeResolver
111105 */
112106 public function __construct (
@@ -115,15 +109,13 @@ public function __construct(
115109 Converter $ converter ,
116110 ExtensionResolver $ phpExtension ,
117111 ManagerFactory $ managerFactory ,
118- Resolver $ resolver ,
119112 VolumeResolver $ volumeResolver
120113 ) {
121114 $ this ->serviceFactory = $ serviceFactory ;
122115 $ this ->fileList = $ fileList ;
123116 $ this ->converter = $ converter ;
124117 $ this ->phpExtension = $ phpExtension ;
125118 $ this ->managerFactory = $ managerFactory ;
126- $ this ->resolver = $ resolver ;
127119 $ this ->volumeResolver = $ volumeResolver ;
128120 }
129121
@@ -145,68 +137,45 @@ public function build(Config $config): Manager
145137 $ manager ->addNetwork (self ::NETWORK_MAGENTO , ['driver ' => 'bridge ' ]);
146138 $ manager ->addNetwork (self ::NETWORK_MAGENTO_BUILD , ['driver ' => 'bridge ' ]);
147139
148- $ volumes = [self ::VOLUME_MAGENTO => $ this ->getVolumeConfig ()];
149-
150140 $ mounts = $ config ->getMounts ();
151141 $ hasSelenium = $ config ->hasSelenium ();
152142 $ hasTmpMounts = $ config ->hasTmpMounts ();
153143
154144 $ hasGenerated = !version_compare ($ config ->getMagentoVersion (), '2.2.0 ' , '< ' );
145+ $ volumes = [];
155146
156- if ($ hasTmpMounts ) {
157- $ volumes [self ::VOLUME_DOCKER_MNT ] = $ this ->getVolumeConfig ('/.docker/mnt ' );
158- }
159-
160- foreach ($ this ->volumeResolver ->getMagentoVolumes (
147+ foreach (array_keys ($ this ->volumeResolver ->getMagentoVolumes (
161148 $ mounts ,
162149 false ,
163- $ hasSelenium ,
164150 $ hasGenerated
165- ) as $ volumeName => $ volume ) {
166- $ syncConfig = [];
167-
168- if (!empty ($ volume ['volume ' ]) && $ config ->getSyncEngine () === self ::SYNC_ENGINE_NATIVE ) {
169- $ syncConfig = $ this ->getVolumeConfig ($ volume ['volume ' ]);
170- }
171- $ volumes [$ volumeName ] = $ syncConfig ;
172- }
173-
174- if ($ config ->getSyncEngine () === self ::SYNC_ENGINE_MOUNT ) {
175- $ volumes [self ::VOLUME_MAGENTO ] = $ this ->getVolumeConfig ();
176- }
177-
178- if ($ config ->hasServiceEnabled (ServiceInterface::SERVICE_SELENIUM )) {
179- $ volumes [self ::VOLUME_MAGENTO_DEV ] = $ this ->getVolumeConfig ('/dev ' );
151+ )) as $ volumeName ) {
152+ $ volumes [$ volumeName ] = [];
180153 }
181154
182155 $ manager ->setVolumes ($ volumes );
183156
184157 $ volumesBuild = $ this ->volumeResolver ->normalize (array_merge (
158+ $ this ->volumeResolver ->getRootVolume (false ),
185159 $ this ->volumeResolver ->getDefaultMagentoVolumes (false , $ hasGenerated ),
186160 $ this ->volumeResolver ->getComposerVolumes ()
187161 ));
188162 $ volumesRo = $ this ->volumeResolver ->normalize (array_merge (
189- $ this ->volumeResolver ->getMagentoVolumes ($ mounts , true , $ hasSelenium , $ hasGenerated ),
163+ $ this ->volumeResolver ->getRootVolume (true ),
164+ $ this ->volumeResolver ->getDevVolumes ($ hasSelenium ),
165+ $ this ->volumeResolver ->getMagentoVolumes ($ mounts , true , $ hasGenerated ),
190166 $ this ->volumeResolver ->getMountVolumes ($ hasTmpMounts )
191167 ));
192168 $ volumesRw = $ this ->volumeResolver ->normalize (array_merge (
193- $ this ->volumeResolver ->getMagentoVolumes ($ mounts , false , $ hasSelenium , $ hasGenerated ),
169+ $ this ->volumeResolver ->getRootVolume (false ),
170+ $ this ->volumeResolver ->getDevVolumes ($ hasSelenium ),
171+ $ this ->volumeResolver ->getMagentoVolumes ($ mounts , false , $ hasGenerated ),
194172 $ this ->volumeResolver ->getMountVolumes ($ hasTmpMounts ),
195173 $ this ->volumeResolver ->getComposerVolumes ()
196174 ));
197175 $ volumesMount = $ this ->volumeResolver ->normalize (
198176 $ this ->volumeResolver ->getMountVolumes ($ hasTmpMounts )
199177 );
200178
201- $ volumePrefix = $ config ->getNameWithPrefix ();
202-
203- if ($ config ->hasMariaDbConf ()) {
204- $ manager ->addVolume (
205- $ volumePrefix . self ::VOLUME_MARIADB_CONF ,
206- $ this ->getVolumeConfig ('/.docker/mysql/mariadb.conf.d ' )
207- );
208- }
209-
210179 $ this ->addDbService ($ manager , $ config , self ::SERVICE_DB , $ dbVersion , $ volumesMount );
211180
212181 if ($ config ->hasServiceEnabled (ServiceInterface::SERVICE_DB_QUOTE )) {
@@ -228,7 +197,7 @@ public function build(Config $config): Manager
228197 $ service ,
229198 $ this ->serviceFactory ->create (
230199 (string )$ service ,
231- ( string ) $ config ->getServiceVersion ($ service ),
200+ $ config ->getServiceVersion ($ service ),
232201 $ this ->getServiceConfig ($ service , $ config )
233202 ),
234203 [self ::NETWORK_MAGENTO ],
@@ -509,7 +478,7 @@ private function addDbService(
509478 $ volumePrefix = $ config ->getNameWithPrefix ();
510479
511480 if ($ config ->hasMariaDbConf ()) {
512- $ mounts [] = $ volumePrefix . self ::VOLUME_MARIADB_CONF . ':/etc/mysql/mariadb.conf.d ' ;
481+ $ mounts [] = self ::VOLUME_MARIADB_CONF . ':/etc/mysql/mariadb.conf.d ' ;
513482 }
514483
515484 $ commands = [];
@@ -523,10 +492,6 @@ private function addDbService(
523492 $ mounts [] = $ volumePrefix . self ::VOLUME_MAGENTO_DB . ':/var/lib/mysql ' ;
524493
525494 if ($ config ->hasDbEntrypoint ()) {
526- $ manager ->addVolume (
527- self ::VOLUME_DOCKER_ETRYPOINT ,
528- $ this ->getVolumeConfig ('/.docker/mysql/docker-entrypoint-initdb.d ' )
529- );
530495 $ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT . ':/docker-entrypoint-initdb.d ' ;
531496 }
532497
@@ -545,10 +510,6 @@ private function addDbService(
545510 $ port = $ config ->getDbQuotePortsExpose ();
546511
547512 $ manager ->addVolume (self ::VOLUME_MAGENTO_DB_QUOTE , []);
548- $ manager ->addVolume (
549- self ::VOLUME_DOCKER_ETRYPOINT_QUOTE ,
550- $ this ->getVolumeConfig ('/.docker/mysql-quote/docker-entrypoint-initdb.d ' )
551- );
552513
553514 $ mounts [] = self ::VOLUME_MAGENTO_DB_QUOTE . ':/var/lib/mysql ' ;
554515 $ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT_QUOTE . ':/docker-entrypoint-initdb.d ' ;
@@ -558,12 +519,6 @@ private function addDbService(
558519 $ port = $ config ->getDbSalesPortsExpose ();
559520
560521 $ manager ->addVolume (self ::VOLUME_MAGENTO_DB_SALES , []);
561- $ manager ->addVolume (
562- self ::VOLUME_DOCKER_ETRYPOINT_SALES ,
563- $ this ->getVolumeConfig (
564- '/.docker/mysql-sales/docker-entrypoint-initdb.d '
565- )
566- );
567522
568523 $ mounts [] = self ::VOLUME_MAGENTO_DB_SALES . ':/var/lib/mysql ' ;
569524 $ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT_SALES . ':/docker-entrypoint-initdb.d ' ;
@@ -632,19 +587,4 @@ private function getServiceConfig(string $service, Config $config): array
632587
633588 return $ serviceConfig ;
634589 }
635-
636- /**
637- * @param string $device
638- * @return array
639- */
640- private function getVolumeConfig (string $ device = '/ ' ): array
641- {
642- return [
643- 'driver_opts ' => [
644- 'type ' => 'none ' ,
645- 'device ' => $ this ->resolver ->getRootPath ($ device ),
646- 'o ' => 'bind '
647- ]
648- ];
649- }
650590}
0 commit comments