Skip to content

Commit 56ffcad

Browse files
authored
Merge branch 'develop' into imported-magento-magento-cloud-docker-298
2 parents dead3a2 + 671b0c2 commit 56ffcad

File tree

11 files changed

+71
-22
lines changed

11 files changed

+71
-22
lines changed

bin/init-docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ add_host()
6969
echo "127.0.0.1 $DOMAIN" | sudo tee -a /etc/hosts
7070
}
7171

72-
PHP_VERSION="7.2"
73-
IMAGE_VERSION="1.1"
72+
PHP_VERSION="7.4"
73+
IMAGE_VERSION="1.2.1"
7474
ADD_HOST=true
7575
DOMAIN="magento2.docker"
7676
USAGE="Init Docker

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"codeception/module-rest": "^1.2",
2727
"consolidation/robo": "^1.2",
2828
"phpmd/phpmd": "@stable",
29-
"phpstan/phpstan": "^0.11",
29+
"phpstan/phpstan": "^0.12",
3030
"phpunit/phpunit": "^8.5",
3131
"squizlabs/php_codesniffer": "^3.0"
3232
},

images/varnish/4.0/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ENV VARNISHD_PARAMS -p default_ttl=3600 -p default_grace=3600 -p feature=+esi_ig
1616

1717
COPY etc/varnish.vcl /data/varnish.vcl
1818

19+
RUN ["chmod", "644", "/data/varnish.vcl"]
1920
RUN ["chmod", "+x", "/entrypoint.sh"]
2021

2122
ENTRYPOINT ["/entrypoint.sh"]

images/varnish/6.2/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
FROM varnish:6.2
22

33
COPY etc/default.vcl /etc/varnish/
4+
5+
RUN ["chmod", "644", "/etc/varnish/default.vcl"]

src/Cli.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CloudDocker;
9+
10+
/**
11+
* Return codes for CLI comamnds.
12+
*
13+
* @codeCoverageIgnore
14+
*/
15+
class Cli
16+
{
17+
public const SUCCESS = 0;
18+
public const FAILURE = 1;
19+
}

src/Command/BuildCompose.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
namespace Magento\CloudDocker\Command;
99

1010
use Magento\CloudDocker\App\GenericException;
11+
use Magento\CloudDocker\Cli;
1112
use Magento\CloudDocker\Compose\DeveloperBuilder;
1213
use Magento\CloudDocker\Compose\BuilderFactory;
1314
use Magento\CloudDocker\Config\ConfigFactory;
1415
use Magento\CloudDocker\Config\Dist\Generator;
1516
use Magento\CloudDocker\Config\Source;
1617
use Magento\CloudDocker\Filesystem\Filesystem;
1718
use Symfony\Component\Console\Command\Command;
19+
use Symfony\Component\Console\Input\ArgvInput;
1820
use Symfony\Component\Console\Input\InputInterface;
1921
use Symfony\Component\Console\Input\InputOption;
2022
use Symfony\Component\Console\Output\OutputInterface;
@@ -308,7 +310,7 @@ protected function configure(): void
308310
*
309311
* @throws GenericException
310312
*/
311-
public function execute(InputInterface $input, OutputInterface $output)
313+
public function execute(InputInterface $input, OutputInterface $output): int
312314
{
313315
$config = $this->configFactory->create([
314316
$this->sourceFactory->create(Source\BaseSource::class),
@@ -323,16 +325,24 @@ public function execute(InputInterface $input, OutputInterface $output)
323325

324326
$this->distGenerator->generate($config);
325327

328+
$content = Yaml::dump([
329+
'version' => $compose->getVersion(),
330+
'services' => $compose->getServices(),
331+
'volumes' => $compose->getVolumes(),
332+
'networks' => $compose->getNetworks()
333+
], 6, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);
334+
335+
if ($input instanceof ArgvInput) {
336+
$content = '# ./vendor/bin/ece-docker ' . $input . PHP_EOL . $content;
337+
}
338+
326339
$this->filesystem->put(
327340
$builder->getPath(),
328-
Yaml::dump([
329-
'version' => $compose->getVersion(),
330-
'services' => $compose->getServices(),
331-
'volumes' => $compose->getVolumes(),
332-
'networks' => $compose->getNetworks()
333-
], 6, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)
341+
$content
334342
);
335343

336344
$output->writeln('<info>Configuration was built.</info>');
345+
346+
return Cli::SUCCESS;
337347
}
338348
}

src/Command/BuildCustomCompose.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\CloudDocker\Command;
99

1010
use Magento\CloudDocker\App\ConfigurationMismatchException;
11+
use Magento\CloudDocker\Cli;
1112
use Magento\CloudDocker\Compose\BuilderFactory;
1213
use Magento\CloudDocker\Config\ConfigFactory;
1314
use Magento\CloudDocker\Config\Dist\Generator;
@@ -101,7 +102,7 @@ protected function configure(): void
101102
* @throws ConfigurationMismatchException
102103
* @throws FilesystemException
103104
*/
104-
public function execute(InputInterface $input, OutputInterface $output)
105+
public function execute(InputInterface $input, OutputInterface $output): int
105106
{
106107
$source = json_decode($input->getArgument(self::ARG_SOURCE), true);
107108

@@ -134,5 +135,7 @@ public function execute(InputInterface $input, OutputInterface $output)
134135
);
135136

136137
$output->writeln('<info>Configuration was built.</info>');
138+
139+
return Cli::SUCCESS;
137140
}
138141
}

src/Command/BuildDist.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
namespace Magento\CloudDocker\Command;
99

10+
use Magento\CloudDocker\Cli;
1011
use Magento\CloudDocker\Config\ConfigFactory;
1112
use Magento\CloudDocker\Config\Dist\Generator;
1213
use Magento\CloudDocker\App\ConfigurationMismatchException;
14+
use Magento\CloudDocker\Filesystem\FilesystemException;
1315
use Symfony\Component\Console\Command\Command;
1416
use Symfony\Component\Console\Input\InputInterface;
1517
use Symfony\Component\Console\Output\OutputInterface;
@@ -67,8 +69,9 @@ protected function configure(): void
6769
* {@inheritDoc}
6870
*
6971
* @throws ConfigurationMismatchException
72+
* @throws FilesystemException
7073
*/
71-
public function execute(InputInterface $input, OutputInterface $output)
74+
public function execute(InputInterface $input, OutputInterface $output): int
7275
{
7376
$config = $this->configFactory->create([
7477
$this->sourceFactory->create(Source\BaseSource::class),
@@ -79,5 +82,7 @@ public function execute(InputInterface $input, OutputInterface $output)
7982
$this->distGenerator->generate($config);
8083

8184
$output->writeln('<info>Dist files generated</info>');
85+
86+
return Cli::SUCCESS;
8287
}
8388
}

src/Command/Image/GenerateEs.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CloudDocker\Command\Image;
99

10+
use Magento\CloudDocker\Cli;
1011
use Magento\CloudDocker\Filesystem\DirectoryList;
1112
use Magento\CloudDocker\Filesystem\Filesystem;
1213
use Symfony\Component\Console\Command\Command;
@@ -21,7 +22,7 @@ class GenerateEs extends Command
2122
private const NAME = 'image:generate:es';
2223

2324
private const SINGLE_NODE = 'RUN echo "discovery.type: single-node" >> '
24-
. '/usr/share/elasticsearch/config/elasticsearch.yml';
25+
. '/usr/share/elasticsearch/config/elasticsearch.yml';
2526

2627
/**
2728
* Configuration map for generating es images data
@@ -93,7 +94,7 @@ protected function configure(): void
9394
*
9495
* {@inheritDoc}
9596
*/
96-
public function execute(InputInterface $input, OutputInterface $output)
97+
public function execute(InputInterface $input, OutputInterface $output): int
9798
{
9899
foreach ($this->versionMap as $version => $versionData) {
99100
$destination = $this->directoryList->getImagesRoot() . '/elasticsearch/' . $version;
@@ -118,5 +119,7 @@ public function execute(InputInterface $input, OutputInterface $output)
118119
}
119120

120121
$output->writeln('<info>Done</info>');
122+
123+
return Cli::SUCCESS;
121124
}
122125
}

src/Command/Image/GeneratePhp.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Composer\Semver\Semver;
1111
use Magento\CloudDocker\App\ConfigurationMismatchException;
12+
use Magento\CloudDocker\Cli;
1213
use Magento\CloudDocker\Filesystem\FileNotFoundException;
1314
use Magento\CloudDocker\Filesystem\Filesystem;
1415
use Magento\CloudDocker\Compose\Php\ExtensionResolver;
@@ -19,7 +20,7 @@
1920
use Symfony\Component\Console\Output\OutputInterface;
2021

2122
/**
22-
* @inheritdoc
23+
* Generates PHP images.
2324
*/
2425
class GeneratePhp extends Command
2526
{
@@ -130,9 +131,10 @@ protected function configure(): void
130131
/**
131132
* {@inheritdoc}
132133
*
133-
* @throws ConfigurationMismatchException|FileNotFoundException
134+
* @throws ConfigurationMismatchException
135+
* @throws FileNotFoundException
134136
*/
135-
public function execute(InputInterface $input, OutputInterface $output)
137+
public function execute(InputInterface $input, OutputInterface $output): int
136138
{
137139
$versions = $input->getArgument(self::ARGUMENT_VERSION);
138140

@@ -150,12 +152,15 @@ public function execute(InputInterface $input, OutputInterface $output)
150152
}
151153

152154
$output->writeln('<info>Done</info>');
155+
156+
return Cli::SUCCESS;
153157
}
154158

155159
/**
156160
* @param string $version
157161
* @param string $edition
158-
* @throws ConfigurationMismatchException|FileNotFoundException
162+
* @throws ConfigurationMismatchException
163+
* @throws FileNotFoundException
159164
*/
160165
private function build(string $version, string $edition): void
161166
{
@@ -177,7 +182,8 @@ private function build(string $version, string $edition): void
177182
* @param string $phpVersion
178183
* @param string $edition
179184
* @return string
180-
* @throws ConfigurationMismatchException|FileNotFoundException
185+
* @throws ConfigurationMismatchException
186+
* @throws FileNotFoundException
181187
*
182188
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
183189
* @SuppressWarnings(PHPMD.NPathComplexity)

0 commit comments

Comments
 (0)