File tree Expand file tree Collapse file tree 2 files changed +16
-20
lines changed
Expand file tree Collapse file tree 2 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -53,26 +53,6 @@ public function __invoke(array $configuration): Configurator\SatelliteBuilderInt
5353 }
5454 }
5555
56- if (isset ($ configuration ['docker ' ]['include ' ]) && is_iterable ($ configuration ['docker ' ]['include ' ])) {
57- foreach ($ configuration ['docker ' ]['include ' ] as $ path ) {
58- if (is_dir ($ path )) {
59- $ builder ->withDirectory (new Packaging \Directory ($ path ));
60- } else {
61- $ builder ->withFile (new Packaging \Asset \LocalFile ($ path ));
62- }
63- }
64- }
65-
66- if (isset ($ configuration ['include ' ])) {
67- foreach ($ configuration ['include ' ] as $ path ) {
68- if (is_dir ($ path )) {
69- $ builder ->withDirectory (new Packaging \Directory ($ path ));
70- } else {
71- $ builder ->withFile (new Packaging \Asset \LocalFile ($ path ));
72- }
73- }
74- }
75-
7656 if (\array_key_exists ('composer ' , $ configuration )) {
7757 if (\array_key_exists ('from_local ' , $ configuration ['composer ' ]) && true === $ configuration ['composer ' ]['from_local ' ]) {
7858 if (file_exists ('composer.lock ' )) {
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ public function dependsOn(string ...$dependencies): self
5656 public function build (
5757 LoggerInterface $ logger ,
5858 ): void {
59+ $ this ->sortFiles ();
5960 $ archive = new TarArchive ($ this ->dockerfile , ...$ this ->files );
6061
6162 $ iterator = function (iterable $ tags ) {
@@ -85,4 +86,19 @@ public function build(
8586 throw new \RuntimeException ('Process exited unexpectedly. ' );
8687 }
8788 }
89+
90+ private function sortFiles (): void
91+ {
92+ uksort ($ this ->files , function ($ a , $ b ) {
93+ if (is_numeric ($ a ) && is_numeric ($ b )) {
94+ return $ a - $ b ;
95+ } elseif (is_numeric ($ a )) {
96+ return -1 ;
97+ } elseif (is_numeric ($ b )) {
98+ return 1 ;
99+ } else {
100+ return strcmp ($ a , $ b );
101+ }
102+ });
103+ }
88104}
You can’t perform that action at this time.
0 commit comments