Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: Environment Variables in Frontend only considered at image build-time #978

Open
gschmutz opened this issue Dec 29, 2024 · 2 comments

Comments

@gschmutz
Copy link

I have tried to integrate llm-graph-builder in my own docker-compose.yml and for that built and pushed the frontend and backend docker images to docker hub so that it does not have to be built on startup.

Doing that I have realized that at least VITE_BACKEND_API_URL and VITE_REACT_APP_SOURCES are only valid and used at build-time of the docker image and cannot be overwritten at runtime using environment variables in the docker-compose.yml.

This makes it difficult to provide the frontend application as a reusable docker image. I'm not sure why this is the case, I'm more of a backend guy and have only limited web app knowledge. Would it be possible to have the environment variables provided at runtime when starting up the docker container? Either directly by using the env variables at runtime or by a configuration file and having that populated dynamically by env variables (if it's the later, then I could offer help on the docker side and how to dynamically create the config file).

@jexp
Copy link
Contributor

jexp commented Jan 10, 2025

I'm not sure if it makes sense to have teh front-end as a generic image. as there is a lot of specific config each time.

We use it mostly as a deployment mechanism.

Also the react setup had issues loading docker env variables in the past when tried to make it work.

@gschmutz
Copy link
Author

gschmutz commented Jan 10, 2025

@jexp thanks for your answer. I have now checked the code with help of ChatGPT to understand what's happening and I understand a bit better how the frontend handles the variables and provide them at built-time.

The reason for my question is that I'm in the process of adding support for llm-graph-builder to the Platys Modern Data Platform, an open-source toolkit which generates customizable docker-compse.yml environments for PoC's and trainings. I'm using a config.yml file to control the behavior of the docker containers and I don't have the concept of building docker images at startup time. Of course I could make an exception for llm-graph-builder, but then I would have to fetch the frontend code when generating the docker-compose.yml. Not all of the services I support so far, can be configured by environment variables, but all of them usually provide a way to specify a configuration file at runtime.

But of course I understand that having the front-end as a generic image is not your top-priority. Will see what I can do, it's already good to know that it is the expected behavior. Think it would be clearer, if the frontend-specific environment variables are removed from the https://github.com/neo4j-labs/llm-graph-builder/blob/main/example.env file in project root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants