Mark
Mark

Reputation: 6455

Rails - Docker - finding the Rails root path in development

I'm working on a project that runs in docker containers, and our assets are not displaying locally. They're saving to the DB as they should, with the issue being the assets_path being created.

When I run the application locally (not in a container) and call Rails.root, I receive the full path (/home/projects/bla...)

When I call Rails.root in the docker container, I receive just '/bla'.

Is there any way of getting docker to figure out what the 'real' Rails root is?

Thanks in advance

Upvotes: 0

Views: 674

Answers (1)

H Dox
H Dox

Reputation: 675

If your project folder is mount to your docker container then you will have to explicitly declare WORKDIR by appending this line to your Dockerfile and rebuild the image.

WORKDIR /home/projects/bla

Hope it helps.

Upvotes: 1

Related Questions