https://github.com/davdiv/buildahcker-alpine-sample
Simple example demonstrating the use of the buildahcker Node.js library to create an Alpine Linux image for booting in a virtual machine (VM).
https://github.com/davdiv/buildahcker-alpine-sample
Last synced: about 1 month ago
JSON representation
Simple example demonstrating the use of the buildahcker Node.js library to create an Alpine Linux image for booting in a virtual machine (VM).
- Host: GitHub
- URL: https://github.com/davdiv/buildahcker-alpine-sample
- Owner: davdiv
- License: mit
- Created: 2024-03-30T17:41:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-02T10:44:45.000Z (6 months ago)
- Last Synced: 2025-01-02T11:29:58.008Z (6 months ago)
- Language: TypeScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# buildahcker-alpine-sample
This is a simple example demonstrating the use of the [buildahcker](https://github.com/davdiv/buildahcker) Node.js library to create an [Alpine Linux](https://www.alpinelinux.org/) image for booting in a virtual machine (VM).
## Dependencies
Make sure you have the following dependencies installed:
- [Buildah](https://buildah.io): buildahcker requires it to create container images
- [Node.js](https://nodejs.org): buildahcker is a Node.js library
- [QEMU](https://www.qemu.org): it can be used to run the generated imageNote that this was only tested on Linux.
## Getting Started
- Clone this repository:
```bash
git clone https://github.com/davdiv/buildahcker-alpine-sample.git
cd buildahcker-alpine-sample
```- Install npm dependencies:
```bash
npm install
```- Build the Alpine image for qemu:
```bash
npm run build qemu
```It will be generated in the `output` folder.
Note that it is configured with the french (`fr`) keyboard layout. You may want to change the configuration to match your own keyboard layout.
- Run the virtual machine with QEMU to test the image:
```bash
npm start
```You should see QEMU booting the image. You can login as `root`. There is no password.
It is also possible to connect through SSH:
```
ssh -p 55022 -i config/qemu/ssh/id_ed25519 root@localhost
```## Explanations
The [build.ts](./build.ts) file uses the [buildahcker](https://github.com/davdiv/buildahcker) library to create an [Alpine Linux](https://www.alpinelinux.org/) image with pre-installed packages, and customized network settings.
The script first creates a squashfs image from the Alpine base image, then writes it into a partition of a new disk image, and finally installs GRUB with a customized configuration to enable bootup in a VM.