Skip to content

Commit

Permalink
Pull docker images and inform user
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc45 committed Mar 24, 2024
1 parent adb2951 commit 11787a1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/src/Environment/Environments/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\Process;
use function QIT_CLI\is_ci;
use function QIT_CLI\is_windows;
use function QIT_CLI\normalize_path;
use function QIT_CLI\use_tty;
Expand Down Expand Up @@ -241,6 +242,22 @@ protected function generate_docker_compose(): void {
protected function up_docker_compose(): void {
$this->add_container_names();

if ( empty( $this->cache->get( 'qit_env_up_first_run' ) ) && ! is_ci() ) {
$this->cache->set( 'qit_env_up_first_run', '1', - 1 );
$this->output->writeln( '<info>First-time setup is pulling Docker images and caching downloads. Subsequent runs will be faster.</info>' );
}

// Do a docker compose pull first, to make sure images are updated.
$pull_process = new Process( array_merge( $this->docker->find_docker_compose(), [ '-f', $this->env_info->temporary_env . '/docker-compose.yml', 'pull' ] ) );
$pull_process->setTimeout( 600 );
$pull_process->setIdleTimeout( 600 );
$pull_process->setPty( use_tty() );
$pull_process->run( function ( $type, $buffer ) {
if ( $this->output->isVerbose() ) {
$this->output->write( $buffer );
}
} );

$args = array_merge( $this->docker->find_docker_compose(), [ '-f', $this->env_info->temporary_env . '/docker-compose.yml', 'up', '-d' ] );

$up_process = new Process( $args );
Expand Down

0 comments on commit 11787a1

Please sign in to comment.