beta9 icon indicating copy to clipboard operation
beta9 copied to clipboard

support env var references in commands

Open dleviminzi opened this issue 1 year ago • 0 comments

This change allows users to reference secrets as environment variables in their image build.

For instance, lets say I create a secret called TEST_TOKEN like this: beta9 secret create TEST_TOKEN hello and another to specify the numpy version I want:

beta9 secret create NUMPY_VERSION 1.22.3

We can now access those values as environment variables.

from beta9 import endpoint, Image

@endpoint(
    cpu=1.0,
    memory=128,
    image=Image(
        commands=['echo $TEST_TOKEN'],
        python_packages=['numpy==$NUMPY_VERSION']
    )
)
def multiply(x, y, z):
    result = x * 2
    return {"result": result}

This makes it possible for users to install private python libraries without having to create a custom base image.

dleviminzi avatar Aug 22 '24 03:08 dleviminzi