Build environment variables

Hi!

I wanted to ask whether you plan on adding build environment variables that can be accessed during the build of the docker image.

We are using private npm modules and need to specify our NPM_TOKEN during build time when node_modules are installing. Currently node_modules are installed in the Dockerfile and it would probably make sense to keep it this way since they don’t change on application restart.

Kind regards,
Peter.

Hey @peterjuras

Currently we do not have build time arguments, but we do have plans to support them. With the multicontainer update you will be able to specify build time arguments in your docker-compose.yml file. Unfortunately I would not recommend this for items such as tokens and api keys, but how build time arguments which are not specified in the docker compose file look in relation to the rest of our infrastructure has not yet been decided.

Rest assured that this is something that we have on our radar and will be tackled.

Other options such as resin deploy would allow you to specify build time arguments and deploy the image from local. Information on that can be found here.

Cameron

Is there any update on providing Docker build arguments, especially for balena local push?
We’d like to be able to use a Dockerfile ARG command, with a default value set for when the build is happening in the cloud, but we’d like to set the build argument for local development to trigger a slightly different build step.

Hi @maciej.ldc,

First of all, we would recommend you move from balena local push to the new balena push <deviceIP>. We will be deprecating and eventually removing the balena local push in the near future.

As for the Docker build arguments: we recently implemented this feature. There are some little things to iron out and put out official documentation. Though you could already start using it right now. Here’s a little doc that explains how to use it:

1 Like