Files
herolib/lib/virt/docker/docker_recipe_env.v
mariobassem b89a9e87c8 feat: Add open-webui example using Docker
- Created an example to create a docker image for open-webui
- The `docker_recipe_env.v` file is updated to correctly handle quoting in environment variables.

Co-authored-by: mahmmoud.hassanein <mahmmoud.hassanein@gmail.com>
2025-02-04 18:44:02 +02:00

30 lines
516 B
V

module docker
pub struct EnvItem {
pub mut:
name string
value string
}
pub fn (mut b DockerBuilderRecipe) add_env(name string, val string) ! {
if name.len < 3 {
return error('min length of name is 3')
}
if val.len < 3 {
return error('min length of val is 3')
}
mut item := EnvItem{
name: name.to_upper()
value: val
}
b.items << item
}
pub fn (mut i EnvItem) check() ! {
// nothing much we can do here I guess
}
pub fn (mut i EnvItem) render() !string {
return 'ENV ${i.name}="${i.value}"'
}