Are app environment vars available at build time?

We need to pass our AWS credentials to a grunt task in our Dockerfile, but it doesn’t seem that convox build (or a build created by an automated workflow) can access any of the environment variables set in the convox.yml or the app’s Environment tab.

Is there a best-practice method for achieving this?

You should be able to accomplish this with Convox Build Variables.

For example, here’s how you can parametrize the version of Bundler for your Ruby app. In your Dockerfile:

FROM ubuntu:16.04
...
ARG BUNDLER_VERSION=2.0.0
RUN gem install bundler -v ${BUNDLER_VERSION} && rbenv rehash
...

This sets a default value for BUNDLER_VERSION which you can then override by setting an environment variable using the Convox CLI, Environment Tab, or convox.yml:

$ convox env set BUNDLER_VERSION=2.00

You can also use declare a build variable without a default value.

Thanks for the prompt reply, Nick.

Does convox env set only need to be run once, and it will then apply for future builds both local and in production?