How can I pass heroku config vars to docker build? How can I pass heroku config vars to docker build? docker docker

How can I pass heroku config vars to docker build?


Without using the heroku.yml a possible solution is to include the env variable in the Dockerfile.
Example with Java code:

CMD java -Dserver.port=$PORT -DmongoDbUrl=$MONGODB_SRV  $JAVA_OPTS -jar /software/myjar.jar

You need to build the image locally, push and release it into the Heroku Registry: when it runs the Config Vars (ie MONGODB_SRV) are injected