@@ -90,11 +90,6 @@ class ProductionBuilder implements BuilderInterface
90
90
*/
91
91
private $ managerFactory ;
92
92
93
- /**
94
- * @var Resolver
95
- */
96
- private $ resolver ;
97
-
98
93
/**
99
94
* @var VolumeResolver
100
95
*/
@@ -106,7 +101,6 @@ class ProductionBuilder implements BuilderInterface
106
101
* @param Converter $converter
107
102
* @param ExtensionResolver $phpExtension
108
103
* @param ManagerFactory $managerFactory
109
- * @param Resolver $resolver
110
104
* @param VolumeResolver $volumeResolver
111
105
*/
112
106
public function __construct (
@@ -115,15 +109,13 @@ public function __construct(
115
109
Converter $ converter ,
116
110
ExtensionResolver $ phpExtension ,
117
111
ManagerFactory $ managerFactory ,
118
- Resolver $ resolver ,
119
112
VolumeResolver $ volumeResolver
120
113
) {
121
114
$ this ->serviceFactory = $ serviceFactory ;
122
115
$ this ->fileList = $ fileList ;
123
116
$ this ->converter = $ converter ;
124
117
$ this ->phpExtension = $ phpExtension ;
125
118
$ this ->managerFactory = $ managerFactory ;
126
- $ this ->resolver = $ resolver ;
127
119
$ this ->volumeResolver = $ volumeResolver ;
128
120
}
129
121
@@ -145,68 +137,45 @@ public function build(Config $config): Manager
145
137
$ manager ->addNetwork (self ::NETWORK_MAGENTO , ['driver ' => 'bridge ' ]);
146
138
$ manager ->addNetwork (self ::NETWORK_MAGENTO_BUILD , ['driver ' => 'bridge ' ]);
147
139
148
- $ volumes = [self ::VOLUME_MAGENTO => $ this ->getVolumeConfig ()];
149
-
150
140
$ mounts = $ config ->getMounts ();
151
141
$ hasSelenium = $ config ->hasSelenium ();
152
142
$ hasTmpMounts = $ config ->hasTmpMounts ();
153
143
154
144
$ hasGenerated = !version_compare ($ config ->getMagentoVersion (), '2.2.0 ' , '< ' );
145
+ $ volumes = [];
155
146
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 (
161
148
$ mounts ,
162
149
false ,
163
- $ hasSelenium ,
164
150
$ 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 ] = [];
180
153
}
181
154
182
155
$ manager ->setVolumes ($ volumes );
183
156
184
157
$ volumesBuild = $ this ->volumeResolver ->normalize (array_merge (
158
+ $ this ->volumeResolver ->getRootVolume (false ),
185
159
$ this ->volumeResolver ->getDefaultMagentoVolumes (false , $ hasGenerated ),
186
160
$ this ->volumeResolver ->getComposerVolumes ()
187
161
));
188
162
$ 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 ),
190
166
$ this ->volumeResolver ->getMountVolumes ($ hasTmpMounts )
191
167
));
192
168
$ 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 ),
194
172
$ this ->volumeResolver ->getMountVolumes ($ hasTmpMounts ),
195
173
$ this ->volumeResolver ->getComposerVolumes ()
196
174
));
197
175
$ volumesMount = $ this ->volumeResolver ->normalize (
198
176
$ this ->volumeResolver ->getMountVolumes ($ hasTmpMounts )
199
177
);
200
178
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
-
210
179
$ this ->addDbService ($ manager , $ config , self ::SERVICE_DB , $ dbVersion , $ volumesMount );
211
180
212
181
if ($ config ->hasServiceEnabled (ServiceInterface::SERVICE_DB_QUOTE )) {
@@ -228,7 +197,7 @@ public function build(Config $config): Manager
228
197
$ service ,
229
198
$ this ->serviceFactory ->create (
230
199
(string )$ service ,
231
- ( string ) $ config ->getServiceVersion ($ service ),
200
+ $ config ->getServiceVersion ($ service ),
232
201
$ this ->getServiceConfig ($ service , $ config )
233
202
),
234
203
[self ::NETWORK_MAGENTO ],
@@ -509,7 +478,7 @@ private function addDbService(
509
478
$ volumePrefix = $ config ->getNameWithPrefix ();
510
479
511
480
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 ' ;
513
482
}
514
483
515
484
$ commands = [];
@@ -523,10 +492,6 @@ private function addDbService(
523
492
$ mounts [] = $ volumePrefix . self ::VOLUME_MAGENTO_DB . ':/var/lib/mysql ' ;
524
493
525
494
if ($ config ->hasDbEntrypoint ()) {
526
- $ manager ->addVolume (
527
- self ::VOLUME_DOCKER_ETRYPOINT ,
528
- $ this ->getVolumeConfig ('/.docker/mysql/docker-entrypoint-initdb.d ' )
529
- );
530
495
$ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT . ':/docker-entrypoint-initdb.d ' ;
531
496
}
532
497
@@ -545,10 +510,6 @@ private function addDbService(
545
510
$ port = $ config ->getDbQuotePortsExpose ();
546
511
547
512
$ 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
- );
552
513
553
514
$ mounts [] = self ::VOLUME_MAGENTO_DB_QUOTE . ':/var/lib/mysql ' ;
554
515
$ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT_QUOTE . ':/docker-entrypoint-initdb.d ' ;
@@ -558,12 +519,6 @@ private function addDbService(
558
519
$ port = $ config ->getDbSalesPortsExpose ();
559
520
560
521
$ 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
- );
567
522
568
523
$ mounts [] = self ::VOLUME_MAGENTO_DB_SALES . ':/var/lib/mysql ' ;
569
524
$ mounts [] = self ::VOLUME_DOCKER_ETRYPOINT_SALES . ':/docker-entrypoint-initdb.d ' ;
@@ -632,19 +587,4 @@ private function getServiceConfig(string $service, Config $config): array
632
587
633
588
return $ serviceConfig ;
634
589
}
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
- }
650
590
}
0 commit comments