()
| 45 | function exec(command, options = {}) { |
| 46 | try { |
| 47 | execSync(command, { stdio: 'inherit', ...options }); |
| 48 | return true; |
| 49 | } catch (error) { |
| 50 | console.error(`Error executing: ${command}`); |
| 51 | console.error(error.message); |
| 52 | return false; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // Build the container image |
| 57 | function buildImage() { |
| 58 | const runtimeLabel = containerRuntime.getRuntimeLabel(); |
| 59 | console.log(`Building container image (${runtimeLabel})...`); |
| 60 | console.log(`Image: ${fullImageName}`); |
| 61 | console.log(''); |
| 62 | |
| 63 | // Podman fails to push images that still reference library/* base layers because |
| 64 | // Docker Hub requests multi-repository auth scopes (e.g. library/node:pull). |
| 65 | const runtime = containerRuntime.getRuntime(); |
| 66 | const squashFlag = runtime.endsWith('podman') ? ' --squash-all' : ''; |
| 67 | const buildCommand = `${runtime} build${squashFlag} -t ${fullImageName} .`; |
| 68 | if (!exec(buildCommand)) { |
no test coverage detected