https://github.com/davdiv/buildahcker
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.
https://github.com/davdiv/buildahcker
alpine bootable build buildah cache container disk docker gpt grub hash oci-image parted partition squashfs
Last synced: 5 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/davdiv/buildahcker
- Owner: davdiv
- License: mit
- Created: 2024-03-09T19:22:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-02T10:38:53.000Z (9 months ago)
- Last Synced: 2025-05-05T22:17:27.623Z (5 months ago)
- Topics: alpine, bootable, build, buildah, cache, container, disk, docker, gpt, grub, hash, oci-image, parted, partition, squashfs
- Language: TypeScript
- Homepage: https://davdiv.github.io/buildahcker/
- Size: 389 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Buildahcker
[](https://www.npmjs.com/package/buildahcker)
Buildahcker is a node.js library to create and run commands in OCI (Open Container Initiative) container images (or docker images), based on [Buildah](https://buildah.io/) 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](https://davdiv.github.io/buildahcker/).
## Installation
```bash
npm install buildahcker --save-dev
```## Usage
Here is a basic sample:
```typescript
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](https://github.com/davdiv/buildahcker/tree/main/test) and [this sample repository](https://github.com/davdiv/buildahcker-alpine-sample) for more usage examples.