fix issue with passing envs into the container. Remove container registry usage.

This commit is contained in:
Sergei Shitikov
2024-09-01 14:43:34 +02:00
parent 58f811ec8a
commit b0e4f60592
10 changed files with 60 additions and 46 deletions
+6 -11
View File
@@ -4,24 +4,19 @@ declare(strict_types=1);
namespace Testcontainers\Container;
use Testcontainers\Wait\WaitForExec;
class MariaDBContainer extends GenericContainer
{
private function __construct(string $version, string $mysqlRootPassword)
public function __construct(string $version = 'latest', string $mysqlRootPassword = 'root')
{
parent::__construct('mariadb:' . $version);
$this->withExposedPorts(3306);
$this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword);
$binary = 'mysqladmin';
if ($version === 'latest' || version_compare($version, '11.0.0', '>')) {
$binary = 'mariadb-admin';
}
$this->withWait(new WaitForExec([$binary, 'ping', '-h', '127.0.0.1']));
}
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self
{
return new self($version, $mysqlRootPassword);