hitobito / development

Setup your local machine for hitobito development
GNU Affero General Public License v3.0
19 stars 15 forks source link

Calling rails c using docker exec #4

Closed carlobeltrame closed 4 years ago

carlobeltrame commented 4 years ago

It is not currently possible to open a rails console quickly as follows:

# neither this...
docker-compose exec rails rails c
# ... not this works
docker-compose exec rails bash -c "rails c"

The reason is that rails is not on $PATH until ~/.bashrc runs. Could we maybe add /opt/app-root/src/hitobito/bin to PATH in e.g. the Dockerfile or docker-compose.yml? (and probably the same for unsetting the APP_ROOT env variable)

Workaround for now is to open bash and then open the rails console:

docker-compose exec rails bash
rails c
mtnstar commented 4 years ago

since it's not really possible to extend existing $PATH variable by docker compose config, I decided to just create a symlink to /opt/app-root/bin. This path is already part of $PATH.

run docker-compose build rails rails-test to update your dev images and apply those changes