From 45e6dc9c1976ee3a83e11db8dabfd415ecb64cf2 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Tue, 7 May 2024 12:22:45 +0100 Subject: [PATCH] fixup! fixup! feat(cli): use cruntime to build snapshot --- apps/cli/src/commands/build.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/apps/cli/src/commands/build.ts b/apps/cli/src/commands/build.ts index 258b720b..aeb51743 100644 --- a/apps/cli/src/commands/build.ts +++ b/apps/cli/src/commands/build.ts @@ -365,34 +365,36 @@ Update your application Dockerfile using one of the templates at https://github. // prepare OCI Bundle const extract = tar.extract(); const pack = tar.pack(); - const appGnuTarStream = fs.createReadStream(appGnutarPath); + const appGnutarStream = fs.createReadStream(appGnutarPath); const appOCIBundleStream = fs.createWriteStream(appOCIBundlePath); const ociConfigJSON = JSON.stringify(createConfig(imageInfo)); + const rootfsPrefix = "rootfs/"; // add config.json pack.entry({ name: "config.json" }, ociConfigJSON, function (err) { if (err) throw err; - console.log("ERROR config.json"); - pack.finalize(); }); + // add rootfs/ directory + pack.entry({ name: rootfsPrefix, type: "directory" }); // add rootfs/ prefix extract.on("entry", function (header, stream, callback) { - header.name = path.join("rootfs", header.name); + header.name = path.join(rootfsPrefix, header.name); stream.pipe(pack.entry(header, callback)); }); - // save tarball for OCI Bundle - appGnuTarStream.pipe(extract); - pack.pipe(appOCIBundleStream); + extract.on("finish", function () { + pack.finalize(); + console.log('extract.on("finish") -> pack.finilize()'); + }); - // appOCIBundleStream.on("close", function () { - // console.log(path + " has been written"); - // }); + appOCIBundleStream.on("close", function () { + console.log(path + " has been written"); + }); - // extract.on("finish", function () { - // pack.finalize(); - // }); + // save tarball for OCI Bundle + appGnutarStream.pipe(extract); + pack.pipe(appOCIBundleStream); // create drive await this.sdkRun(