Skip to content

Commit

Permalink
Added commands for docker and composer
Browse files Browse the repository at this point in the history
  • Loading branch information
sebprt committed Dec 15, 2023
1 parent e1084b7 commit 000e9e9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/Dockerfile/Arg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Kiboko\Component\Dockerfile\Dockerfile;

final readonly class Arg implements LayerInterface, \Stringable
{
public function __construct(
private string $name,
) {
}

public function __toString(): string
{
return sprintf('ARG %s', $this->name);
}
}
28 changes: 28 additions & 0 deletions src/PHP/ComposerConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Kiboko\Component\Dockerfile\PHP;

use Kiboko\Component\Dockerfile\Dockerfile;

final class ComposerConfig implements Dockerfile\LayerInterface, \Stringable
{
public function __construct(
private string $host,
private string $token,
)
{
}

public function __toString(): string
{
return (string) new Dockerfile\Run(sprintf(
<<<'RUN'
composer config --global %s %s
RUN,
$this->host,
$this->token,
));
}
}
2 changes: 1 addition & 1 deletion src/PHP/ComposerRequire.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __toString(): string
{
return (string) new Dockerfile\Run(sprintf(<<<'RUN'
set -ex \
&& composer require --prefer-dist --no-progress --prefer-stable --sort-packages --optimize-autoloader --with-dependencies %s
&& composer require --prefer-dist --no-progress --prefer-stable --sort-packages --optimize-autoloader --with-all-dependencies %s
RUN, implode(' ', $this->packages)));
}
}

0 comments on commit 000e9e9

Please sign in to comment.