Skip to content

Commit

Permalink
fixup! fixup! feat(cli): use cruntime to build snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed May 7, 2024
1 parent 4e4692e commit 45e6dc9
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions apps/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 45e6dc9

Please sign in to comment.