I am running a Rails app in a Docker container on Heroku. In order to get this running I need to either have the ./config/master.key file in the container or the RAILS_MASTER_KEY environment variable set which would be preferable.
How would I do this?
The approach that seemed logical to me was to pass the variable as an build-arg in the heroku.yml file. Unfortunately this is not possible because the config vars are not available at build time.
Another approach was to read the config var using a bash script and writing it to a file which then would be copied into the Docker container. This did not work because of the same reasons (Not possible to access config vars on build time)
My heroku.yml:
build:
docker:
web: Dockerfile
run:
web: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
Do I need to use a different way to store the key than the Heroku config vars?
I am a bit confused to not find anything about this online as it seems to be a necessary thing to do for everyone running Rails in a Docker container on Heroku.
Thanks for any hints!