Skip to content

Commit ffa6c23

Browse files
feat: allow for custom run.yaml at container runtime
this commit adds an entrypoint shell script that aligns with the upstream containers it allows users to pass a custom run.yaml if they so choose while keeping the official run.yaml we ship with the distro image as a default Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
1 parent a55d442 commit ffa6c23

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,18 @@ Various tags are maintained for this image:
5353
- `rhoai-v*-latest` will always point to the latest image that has been built off of a merge to the corresponding `rhoai-v*` branch
5454

5555
You can see the source code that implements this build strategy [here](.github/workflows/redhat-distro-container.yml)
56+
57+
### Running with a custom run YAML
58+
59+
The distribution image allows you to run a custom run YAML file within it. To do so, run the image in the following way. The "path" mentioned should be the path to your custom run YAML file.
60+
61+
```bash
62+
podman run \
63+
-p 8321:8321 \
64+
-v <path_on_host>:<path_in_container> \
65+
-e RUN_CONFIG_PATH=<path_in_container> \
66+
quay.io/opendatahub/llama-stack:<tag>
67+
```
68+
69+
> [!IMPORTANT]
70+
> The distribution image ships with various dependencies already pre-installed. There is *no* guarantee that your custom run YAML will necessarily work with the included dependencies.

distribution/Containerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ RUN pip install --no-deps sentence-transformers
5959
RUN pip install --no-cache llama-stack==0.2.23
6060
RUN mkdir -p ${HOME}/.llama ${HOME}/.cache
6161
COPY distribution/run.yaml ${APP_ROOT}/run.yaml
62-
ENTRYPOINT ["llama", "stack", "run", "/opt/app-root/run.yaml"]
62+
COPY distribution/entrypoint.yaml ${APP_ROOT}/entrypoint.sh
63+
RUN chmod +x ${APP_ROOT}/entrypoint.sh
64+
ENTRYPOINT [ "/opt/app-root/entrypoint.sh" ]

distribution/Containerfile.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ RUN pip install sqlalchemy # somehow sqlalchemy[asyncio] is not sufficient
55
{dependencies}
66
RUN pip install --no-cache llama-stack==0.2.23
77
{llama_stack_install_source}
8+
89
RUN mkdir -p ${{HOME}}/.llama ${{HOME}}/.cache
910
COPY distribution/run.yaml ${{APP_ROOT}}/run.yaml
1011

11-
ENTRYPOINT ["llama", "stack", "run", "/opt/app-root/run.yaml"]
12+
COPY distribution/entrypoint.yaml ${{APP_ROOT}}/entrypoint.sh
13+
RUN chmod +x ${{APP_ROOT}}/entrypoint.sh
14+
15+
ENTRYPOINT [ "/opt/app-root/entrypoint.sh" ]

distribution/entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -n "$RUN_CONFIG_PATH" ] && [ -f "$RUN_CONFIG_PATH" ]; then
5+
exec llama stack run "$RUN_CONFIG_PATH" "$@"
6+
fi
7+
8+
if [ -n "$DISTRO_NAME" ]; then
9+
exec llama stack run "$DISTRO_NAME" "$@"
10+
fi
11+
12+
exec llama stack run /opt/app-root/run.yaml "$@"

0 commit comments

Comments
 (0)