diff --git a/src/Adapter/Docker/Factory.php b/src/Adapter/Docker/Factory.php index 7d6d88be..80600a6f 100644 --- a/src/Adapter/Docker/Factory.php +++ b/src/Adapter/Docker/Factory.php @@ -53,26 +53,6 @@ public function __invoke(array $configuration): Configurator\SatelliteBuilderInt } } - if (isset($configuration['docker']['include']) && is_iterable($configuration['docker']['include'])) { - foreach ($configuration['docker']['include'] as $path) { - if (is_dir($path)) { - $builder->withDirectory(new Packaging\Directory($path)); - } else { - $builder->withFile(new Packaging\Asset\LocalFile($path)); - } - } - } - - if (isset($configuration['include'])) { - foreach ($configuration['include'] as $path) { - if (is_dir($path)) { - $builder->withDirectory(new Packaging\Directory($path)); - } else { - $builder->withFile(new Packaging\Asset\LocalFile($path)); - } - } - } - if (\array_key_exists('composer', $configuration)) { if (\array_key_exists('from_local', $configuration['composer']) && true === $configuration['composer']['from_local']) { if (file_exists('composer.lock')) { diff --git a/src/Adapter/Docker/Satellite.php b/src/Adapter/Docker/Satellite.php index a3fec7e0..90863069 100644 --- a/src/Adapter/Docker/Satellite.php +++ b/src/Adapter/Docker/Satellite.php @@ -56,6 +56,7 @@ public function dependsOn(string ...$dependencies): self public function build( LoggerInterface $logger, ): void { + $this->sortFiles(); $archive = new TarArchive($this->dockerfile, ...$this->files); $iterator = function (iterable $tags) { @@ -85,4 +86,19 @@ public function build( throw new \RuntimeException('Process exited unexpectedly.'); } } + + private function sortFiles(): void + { + uksort($this->files, function ($a, $b) { + if (is_numeric($a) && is_numeric($b)) { + return $a - $b; + } elseif (is_numeric($a)) { + return -1; + } elseif (is_numeric($b)) { + return 1; + } else { + return strcmp($a, $b); + } + }); + } }