Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to setup for docker and or vendor/bundle? #77

Open
mhenrixon opened this issue Apr 19, 2021 · 3 comments
Open

How to setup for docker and or vendor/bundle? #77

mhenrixon opened this issue Apr 19, 2021 · 3 comments

Comments

@mhenrixon
Copy link

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.

@joshmfrankel
Copy link
Member

joshmfrankel commented Feb 10, 2022

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.

@kaste
Copy link
Contributor

kaste commented Feb 14, 2022

Shouldn't

   "executable": ["docker-compose", "run", "--rm", "web", "bundle", "exec", "rubocop"]

then also work, 🤔?

@joshmfrankel
Copy link
Member

Good point @kaste! Seems reasonable to assume it would. Can't remember why I didn't try that first 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants