Skip to content

Commit

Permalink
feat(CLI): Add docker pull status information when required
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Feb 10, 2023
1 parent b7c2a54 commit 977b8f9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/itk-wasm-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ function processCommonOptions() {
dockerImage = options.image
}

const dockerImageCheck = spawnSync('docker', ['images', '--quiet', dockerImage], {
env: process.env,
stdio: 'pipe',
encoding: 'utf-8',
})

if (dockerImageCheck.stdout === '') {
console.log(`Build environment image not found, pulling ${dockerImage}...`)
const dockerPull = spawnSync('docker', ['pull', dockerImage], {
env: process.env,
stdio: 'inherit',
encoding: 'utf-8',
})
if (dockerPull.status !== 0) {
console.error(`Could not pull docker image ${dockerImage}`)
process.exit(dockerPull.status)
}
}

// Ensure we have the 'dockcross' Docker build environment driver script
const dockcrossScript = path.join(buildDir, 'itk-wasm-build-env')
try {
Expand Down

0 comments on commit 977b8f9

Please sign in to comment.