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>
This commit is contained in:
30
examples/virt/docker/ai_web_ui/ai_web_ui.vsh
Normal file
30
examples/virt/docker/ai_web_ui/ai_web_ui.vsh
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
|
||||||
|
|
||||||
|
import freeflowuniverse.herolib.virt.docker
|
||||||
|
|
||||||
|
mut engine := docker.new(prefix: '', localonly: true)!
|
||||||
|
|
||||||
|
mut r := engine.recipe_new(name: 'dev_ubuntu', platform: .ubuntu)
|
||||||
|
|
||||||
|
r.add_from(image: 'ubuntu', tag: 'latest')!
|
||||||
|
r.add_package(name: 'git,curl')!
|
||||||
|
|
||||||
|
r.add_zinit()!
|
||||||
|
r.add_sshserver()!
|
||||||
|
|
||||||
|
r.add_run(cmd: 'curl -LsSf https://astral.sh/uv/install.sh | sh')!
|
||||||
|
r.add_env('PATH', '/root/.local/bin:\$PATH')!
|
||||||
|
r.add_run(cmd: 'uv python install 3.12')!
|
||||||
|
r.add_run(cmd: 'uv venv /opt/venv')!
|
||||||
|
r.add_env('VIRTUAL_ENV', '/opt/venv')!
|
||||||
|
r.add_env('PATH', '/opt/venv/bin:\$PATH')!
|
||||||
|
r.add_run(cmd: 'uv pip install open-webui')!
|
||||||
|
r.add_zinit_cmd(
|
||||||
|
exec: "bash -c 'VIRTUAL_ENV=/opt/venv DATA_DIR=~/.open-webui /root/.local/bin/uvx --python 3.12 open-webui serve'"
|
||||||
|
name: 'open-webui'
|
||||||
|
)!
|
||||||
|
|
||||||
|
r.add_run(cmd: 'apt-get clean')!
|
||||||
|
r.add_run(cmd: 'rm -rf /var/lib/apt/lists/*')!
|
||||||
|
|
||||||
|
r.build(true)!
|
||||||
@@ -25,5 +25,5 @@ pub fn (mut i EnvItem) check() ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut i EnvItem) render() !string {
|
pub fn (mut i EnvItem) render() !string {
|
||||||
return "ENV ${i.name}='${i.value}'"
|
return 'ENV ${i.name}="${i.value}"'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user