How to setup for docker and or vendor/bundle?
Has anyone successfully setup the rubocop linter for projects running exclusively inside docker? Currently, I'm having all gems installed inside vendor/bundle in the hopes of making them more accessible.
That said, all gems are installed inside a Linux docker container and might not be usable from outside docker (my host is a Mac beast).
Just curious if anyone has finally solved this issue. Would be nice to have integration with rubocop inside the docker container somehow.
That said, all gems are installed inside a Linux docker container and might not be usable from outside docker
Correct. I don't believe you'll have direct access to these gems without using docker-compose or the like.
That being said, I've had decent success interacting with rubocop via docker-compose by first creating a shell executable file
touch docker-rubocop
#!/bin/bash
docker-compose run --rm web bundle exec rubocop $@
Then just specify the absolute path to the executable within your SublimeLinter settings file
"rubocop": {
"executable": "~/Development/project_folder/docker-rubocop"
}
$@ will ferry commands that SublimeLinter-rubocop sends to the executable over to docker.
You'll need to change the service (mine is web above) that you are using for running rails server above appropriately.
Shouldn't
"executable": ["docker-compose", "run", "--rm", "web", "bundle", "exec", "rubocop"]
then also work, 🤔?
Good point @kaste! Seems reasonable to assume it would. Can't remember why I didn't try that first 🤔