I'm using rails 5.2 and trying to use ActiveStorage with docker-compose
.
I set my access_key_id
and secret_key
with EDITOR=vim rails credentials:edit
on my local computer.
But I don't know how I can set those keys in a container.
Any idea?
rails credentials:edit
produces/edits config/credentials.yml.enc
which is encrypted and you can safely commit it along with your other code,
and this file along with code should end up inside the container.
Then you should set RAILS_MASTER_KEY
environment variable when running the container and rails will be able to decrypt.
compose_target:
image: 'your_image'
environment:
- RAILS_MASTER_KEY=here_goes_the_key_do_not_commit_it
or docker run ... -e RAILS_MASTER_KEY=lala
(just be sure this key is not leaked/commited in the same repository)