GithubHelp home page GithubHelp logo

Comments (23)

micdahl avatar micdahl commented on August 11, 2024 2

It is because there is a function which searches for "Dockerfile" to determine the projects root directory. If there is none, the use of docker is disabled. This was intended to enable docker-compose from the root directory of the project, if some files deeper in the directory tree are beeing edited when rspec mode is run. Even the projects root directory is needed to get the relative filename of specs to run. As a quick workaround you can create an empty Dockerfile in your apps root directory.

To resolve the issue, there could be a distinction if docker or docker-compose is given as rspec-docker-command. Also it would be reasonable to look for "docker-compose.yml" instead of "Dockerfile" and/or to allow a variable filename to find projects root.

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024 1

I think most of those are used for scripting purposes, don't they? Like, the CI script copies docker-compose.gitlab.yml to docker-compose.yml before running the build.

In any case, I can simply add a custom var with the file name to look for.

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024 1

some people might be still using Docker without docker-compose

Then they have to customize docker-command anyway.

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024

Is there a Dockerfile in the project root?

from rspec-mode.

fibrasek avatar fibrasek commented on August 11, 2024

@dgutov yes, but they end with different extensions, eg.: Dockerfile.aws

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024

How do you choose which one to use?

from rspec-mode.

fibrasek avatar fibrasek commented on August 11, 2024

Locally its used via docker-compose

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024

What is?

from rspec-mode.

fibrasek avatar fibrasek commented on August 11, 2024

You can read about docker-compose here

from rspec-mode.

fibrasek avatar fibrasek commented on August 11, 2024

@micdahl seems a reasonable workaround. Extending the topic, which function looks for the Dockerfile in the project root? Maybe extending how it searches for the file could solve the issue of having multiple Dockerfiles with extensions.

from rspec-mode.

micdahl avatar micdahl commented on August 11, 2024

After revisiting, I found the responsible code here. I think the second part of the and statement could just be removed, so that rspec-docker-p only relies on rspec-use-docker-when-possible:

(defun rspec-docker-p ()
  rspec-use-docker-when-possible)

That should do the trick, but I am unsure about the correct use of lisp, as I haven't had a look on it for years.

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024

@fibrasek You can certainly use advice on rspec-docker-p to make it behave however you like.

@micdahl Not sure simply removing the existence check is the correct approach. After all, all other similar variables work that way. At the very least, the option would have to be renamed.

from rspec-mode.

fibrasek avatar fibrasek commented on August 11, 2024

@dgutov thanks for the tip, Ill look up on how to properly use advice, since my lisp skills are pretty basic 😄

from rspec-mode.

nfedyashev avatar nfedyashev commented on August 11, 2024

I believe that it is worth mentioning in README that rspec-mode expects to find Dockerfile in the root directory. For new users it is very confusing because having Dockerfile in non-root directory is pretty common practice(for example https://github.com/evilmartians/terraforming-rails/tree/master/examples/dockerdev ).

Other than that rspec-mode is awesome

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024

@nfedyashev How can we support this use case? Can we just look for docker-compose.yml as well?

from rspec-mode.

nfedyashev avatar nfedyashev commented on August 11, 2024

@dgutov

Can we just look for docker-compose.yml as well?

yes or checking for the presence of files named like docker-compose* - it covers cases like

docker-compose.yml
docker-compose.consul.yml
docker-compose.dev.yml
docker-compose.prod.yml
docker-compose.override.yml
docker-compose.sec.yml
docker-compose.storage.yml
docker-compose.sync.yml
docker-compose.development.yml

Examples were taken from https://github.com/search?q=docker-compose&type=Code

from rspec-mode.

nfedyashev avatar nfedyashev commented on August 11, 2024

Although I never used custom docker-compose yaml confg files(like docker-compose.custom.yml) I suspect some may use it for expressiveness/explicitness in their complex projects.

CI script most likely doesn't need to copy/rename docker-compose config files because it can explicitly specify which config to pick up using docker-compose -f docker-compose.custom.yml

In any case, I can simply add a custom var with the file name to look for.

👍
and the default value would be "docker-compose.yml"? This should solve the issue for most generic projects and make it really easy to understand what to do in the case of custom Compose files because it is explicit and clear in form of variable name.

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024

and the default value would be "docker-compose.yml"?

Why not "Dockerfile"? :)

In your experience, do people use Docker without docker-compose these days?

from rspec-mode.

pedz avatar pedz commented on August 11, 2024

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024

I'm, uh, trying to minimize the number of disk accesses in the default config (mostly important when one uses Tramp, but still). The var could be a list, but the default would have one element.

Speaking of, one of the recent PRs sneaked in a change in the default of rspec-docker-command. @pedz, did you have to customize that?

from rspec-mode.

pedz avatar pedz commented on August 11, 2024

from rspec-mode.

dgutov avatar dgutov commented on August 11, 2024

Given that this is Docker + RoR + Development (since this is using Rspec) … I’d go with docker compose

Excellent, docker-compose it is!

Turns out you can use Brave instead of Chrome

Or, um, Firefox?

from rspec-mode.

nfedyashev avatar nfedyashev commented on August 11, 2024

@dgutov

and the default value would be "docker-compose.yml"?
Why not "Dockerfile"? :)

oh, sorry, I might have misunderstood your point.
I thought that's going to be combined check(presence of Dockerfile OR docker-compose.yml).

In your experience, do people use Docker without docker-compose these days?

I guess some people might be still using Docker without docker-compose.

from rspec-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.