spree_starter icon indicating copy to clipboard operation
spree_starter copied to clipboard

Docker configuration update - No more issues with file permissions

Open trane77 opened this issue 4 years ago • 2 comments

Description

I started to work with this starter project, but using docker, every time that I launch a command (eg. generate a migration / model), then the generated files result created by root on my host machine, and are not editable in turn.

To avoid this problem, I followed this guide. After rebuilding the images, and launching docker-compose, now each service uses "user" instead of "root". "user" shares the same UID/GID as my host user (1000/1000), and so generated files are finally editable on the host machine, without any change of permissions.

I've included some Readme info, but English is not my main language, so please, feel free to update the description if this PR will be approved.

Hope that you will find this useful, as I do :-)

Cheers Federico

trane77 avatar Aug 06 '21 17:08 trane77

Hi @funder7

There is some problem with permission when running bundle install inside the container -

user@330b0ae308a5:/app$ bundle install
Using rake 13.0.3
Errno::EACCES: Permission denied @ rb_sysopen - /bundle/bin/rake

damianlegawiec avatar Aug 14 '21 11:08 damianlegawiec

Hello @damianlegawiec, You're right, I noticed that yesterday, now I've pushed an update, now it's possible to run bundle install also from inside of the container without issues.

Also I had a problem with the .env file: starting the project without it, lead to docker-compose creating it, but as a folder. That blocked the correct startup of the web service. Probably it's a secondary issue as the setup script creates the .env file. Anyway I removed it from the docker-compose.yml file, as it's already included in the /app folder from what I can see.

Basically now there are no more issues related to this, as, if the file exists, then it's copied like the other files in the project. If it doesn't exist, then nothing happens and every docker service can start regularly.

I hope that now everything is fixed!

trane77 avatar Aug 14 '21 18:08 trane77