Device variables at build-time

Sorry for posting this twice, I deleted my previous post as I wanted to write a better post, instead of just editing it.

My problem is that I need access to device variables at built-time.

I have 4 docker containers being built through a docker-compose.yml file, but one of the containers needs access to device environment variables upon built time. However, it seems these are not made available to the containers until after they have been built and deployed, is that correct?

If I do a RUN env in one of the container’s Dockerfile, I see only a few environment variables from the host os, not all the device variables.

Am I missing something?

Hey there, have you checked this section of the documentation? You can just create a .balena directory locally with the environment variables you want to have at build-time. Let me know if that works for you

If you wish to use some environment variables that are defined from the dashboard, you can probably use the CLI’s envs command more info here and write a small scripts that creates the balena.yaml or secrets files from the data returned there.

HI @sradevski thanks for your input. I will try and look into this.