Pipe output for better logging

This commit is contained in:
Reinier Criel 2025-12-11 09:32:53 -08:00 committed by Sander Declerck
parent fce81d8210
commit 0d1283a0fc
No known key found for this signature in database

View file

@ -35,10 +35,14 @@ export class DockerTestContainer {
execSync( execSync(
`docker build --progress=plain -t ${imageName} -f ${dockerFile} ${contextPath} ${buildArgs}`, `docker build --progress=plain -t ${imageName} -f ${dockerFile} ${contextPath} ${buildArgs}`,
{ {
stdio: "inherit", stdio: "pipe",
maxBuffer: 50 * 1024 * 1024, // 50MB buffer to capture verbose build logs
} }
); );
} catch (error) { } catch (error) {
// Only print the build logs if the build fails
if (error.stdout) console.log(error.stdout.toString());
if (error.stderr) console.error(error.stderr.toString());
throw new Error(`Failed to build Docker image: ${error.message}`); throw new Error(`Failed to build Docker image: ${error.message}`);
} }
} }