feat: Add basic heropods container example

- Initialize `heropods` factory using Podman
- Create, start, and stop a custom `alpine` container
- Execute a command within the container
- Add debug log for container command execution
This commit is contained in:
Mahmoud-Emad
2025-09-08 14:29:26 +03:00
parent 196bcebb27
commit 41c8f7cf6d
2 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env -S v -n -w -cg -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.virt.heropods
mut factory := heropods.new(
reset: false
use_podman: true
) or { panic('Failed to init ContainerFactory: ${err}') }
mut container := factory.new(
name: 'myalpine'
image: .custom
custom_image_name: 'alpine_3_20'
docker_url: 'docker.io/library/alpine:3.20'
)!
container.start()!
container.exec(cmd: 'ls')!
container.stop()!