Thank you for your detailed guide. It helped me a lot with ECR/ECS operations.
I think when you package your code into the Docker image, master.key file is included, so you don't need to set RAILS_MASTER_KEY.
And I'm also thinking that we should only deploy code committed to git, instead of packaging all code in current PC into the image. Maybe using git clone inside Dockerfile instead of COPY .?
Hi Phan, I'm glad you found the article useful. :D For the master.key, I explicitly added RAILS_MASTER_KEY to make sure this works for people who would be cloning my GitHub repository instead of rails new and starting their own project from scratch. I also think it would be one less step to worry about for people who would want to set up a dedicated build server for building their docker images. But point take that if you already have master.key on your local, then this step will be redundant (not to mention master.key and RAILS_MASTER_KEY would have different values)
I haven't considered using git clone for a project like this. I think that could work but my problem with that is you would have to fetch the entire repository every time you build your Docker image. This could take long for big projects. Also, most projects are private so you would have to find a way to pass your SSH credentials to docker while it is building your image.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you for your detailed guide. It helped me a lot with ECR/ECS operations.
I think when you package your code into the Docker image,
master.key
file is included, so you don't need to setRAILS_MASTER_KEY
.And I'm also thinking that we should only deploy code committed to git, instead of packaging all code in current PC into the image. Maybe using
git clone
inside Dockerfile instead ofCOPY .
?Hi Phan, I'm glad you found the article useful. :D For the
master.key
, I explicitly addedRAILS_MASTER_KEY
to make sure this works for people who would be cloning my GitHub repository instead ofrails new
and starting their own project from scratch. I also think it would be one less step to worry about for people who would want to set up a dedicated build server for building their docker images. But point take that if you already havemaster.key
on your local, then this step will be redundant (not to mention master.key andRAILS_MASTER_KEY
would have different values)I haven't considered using
git clone
for a project like this. I think that could work but my problem with that is you would have to fetch the entire repository every time you build your Docker image. This could take long for big projects. Also, most projects are private so you would have to find a way to pass your SSH credentials to docker while it is building your image.