Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

buildahcker

davdiv55MIT0.8.0TypeScript support: included

Buildahcker is a node.js library to create and run commands in OCI (Open Container Initiative) container images (or docker images), based on Buildah and a hash-based cache. It also contains utilities to easily create a partitioned bootable disk image of a

buildah, build, docker, image, OCI, Open Container Initiative, container, hash, cache, squashfs, mksquashfs, parted, partition, gpt, grub, grub-install, grub-bios-setup, disk, boot, bootable

readme

Buildahcker

npm

Buildahcker is a node.js library to create and run commands in OCI (Open Container Initiative) container images (or docker images), based on Buildah and a hash-based cache. It also contains utilities to easily create a partitioned bootable disk image of a Linux system.

Have a look to the API documentation here.

Installation

npm install buildahcker --save-dev

Usage

Here is a basic sample:

import {
  defaultContainerCache,
  ImageBuilder,
  run,
  addFiles,
  MemFile,
  DiskLocation,
} from "buildahcker";

const createImage = async () => {
  const builder = await ImageBuilder.from("alpine:latest", {
    logger: process.stdout,
    containerCache: defaultContainerCache(),
  });
  await builder.executeStep([
    run(["apk", "add", "--no-cache", "nginx"]),
    addFiles({
      "etc/issue": new MemFile({
        content: "Hello",
      }),
      app: new DiskLocation("./app", {
        overrideAttributes: { uid: 1, gid: 2 },
      }),
    }),
  ]);
  console.log("Created image: ", builder.imageId);
};

createImage();

Check the tests and this sample repository for more usage examples.