Kyle McChesney

    Kyle McChesney

    1 year ago
    I am trying to set some custom environment variables for the code running in my flows. This code is python code in a custom module thats installed into my docker container and imported by my flow code. To that end, I’d like to avoid making it dependent on prefect to access said environment variables (ex: from prefect config, etc). I have added a script to
    /etc/profile.d/
    that exports the necessary env vars, but it does not seem to be loaded by default. Likely due to ENTRYPOINT/CMD issues (no login shell?). Wondering if anyone has found a way to do this. I am aware that I could configure the agent to pass env vars in OR update the run config for the flow with them but for a number of reasons, I am hoping to avoid this. The goal is to get env vars set somehow in docker build that are loaded through a normal “source” type process on container start
    hunter

    hunter

    1 year ago
    Can you directly set the environment variables in the Docker image with a
    ENV VARIABLE_NAME=value
    layer?
    Kyle McChesney

    Kyle McChesney

    1 year ago
    I was hoping to avoid build-args (I need the env vars to be dynamic, I am building the container for multiple environments via a CI process). But seems like thats going to be the best bet
    Kevin Kho

    Kevin Kho

    1 year ago
    Gotcha yeah I think I have nothing to add here. Seems like you know all the available routes.