Giter Site home page Giter Site logo

Comments (4)

nyurik avatar nyurik commented on May 29, 2024 1

A temporary workaround could be to add an alias to bash

from martin.

justb4 avatar justb4 commented on May 29, 2024 1

This is a common problem, that will still remain some years, until docker compose is the only command.
We solved this in a workshop launch control Bash script like @nyurik indicated: sniff for the variant and set an alias. See these lines i.e.:

# Sniff which Docker Compose variant is installed
# and set an alias.
# See https://github.com/geopython/geopython-workshop/issues/82
if command docker-compose --version &> /dev/null
then
  alias dockercompose='docker-compose'
  echo "Using docker-compose"
else
  if !command docker compose version &> /dev/null
  then
    echo "Neither docker-compose nor docker compose is available"
    echo "Check your Docker Installation"
    exit 1
  fi
  alias dockercompose='docker compose'  
  echo "Using docker compose"
fi

..and then use the alias dockercompose. Never heard of just (other than my first name..) but seems something to be added in the justfile as bash is presumed? Will PR...

from martin.

nyurik avatar nyurik commented on May 29, 2024

I think we may need to test if the system has a docker-compose, and if it does not, use docker compose - something similar to the check we have in the cargo-install just command - but do it once when just starts up?

from martin.

justb4 avatar justb4 commented on May 29, 2024

The "bash-script" approach in my comment above does not really work direct in a justfile because of the 'just-syntax'. But figured out an alternative, using standard var and -substitution, so an approach with oneliner:

dockercompose := `if docker-compose --version &> /dev/null; then echo "docker-compose"; else echo "docker compose"; fi`
.
.
up:
   {{ dockercompose }} up

up-build:
    {{ dockercompose }} up --build
.
.

There is a justfile in the repo root and the demo dir. Will go ahead with this approach.

from martin.

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.