Created
May 13, 2017 10:50
-
-
Save bka/02a555b5367692273539513b55a8e464 to your computer and use it in GitHub Desktop.
Build a Dockerfile with docker-php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$docker = new \Docker\Docker(); | |
$imageManager = $docker->getImageManager(); | |
$context = new \Docker\Context\Context('/path/to/docker/Dockerfile'); | |
$inputStream = $context->toStream(); | |
$buildStream = $imageManager->build($inputStream, [ | |
't' => "meinimage", | |
'rm' => true, | |
'nocache' => false | |
], ImageManager::FETCH_STREAM); | |
$buildStream->onFrame(function (BuildInfo $buildInfo) { | |
$status = $buildInfo->getStream(); | |
$progress = $buildInfo->getProgress(); | |
if ($status != "") { | |
echo $status . "\n"; | |
} elseif ($progress != "") { | |
echo $progress . "\n"; | |
} | |
}); | |
$buildStream->wait(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment