Closed Fuco1 closed 5 years ago
I've been thinking about what that might look like in #91. Right now args are all expected to be task names. I don't see an obvious way to make this work a command for each task.
Let's close this and track in 91, that covers the use-case.
But I feel this ticket is about passing args to commands that would run after the image is built:
We currently use npm-scripts (with npm-run-all, cross-env, cross-var) to provide a cli interface to all our docker-compose tasks... but we want something that supports a help menu with obvious commands the user would use.
currently, we'd have a package.json
like:
{
"name": "the-project",
"scripts": {
"compose:run": "docker-compose --rm run",
"compose:serve": "docker-compose --rm --service-ports run",
"backend:shell": "npm run compose:run -- backend /bin/bash",
"frontend:shell": "npm run compose:run -- frontend /bin/bash",
}
}
We have many more tasks in there, but for example you see there that we're using the compose:run
task again and passing different arguments to docker-compose
each time. You do this with the --
So with dobi:
mount=source:
bind: ./
path: /opt/app
image=image_backend:
context: .
dockerfile: ./docker/backend/Dockerfile
image: us/backend
tags: [ "latest" ]
job=backend-shell:
use: image_backend
interactive: true
command: /bin/bash
job=backend-pipenv:
use: image_backend
interactive: true
command: pipenv
So now, it'd be awesome if I could do the following:
$ dobi backend-shell -- ls -al
$ dobi backend-pipenv -- run ./manage.py migrate
$ dobi backend-pipenv -- install django-registration
i've only use --
in the dobi commands there to illustrate that everything after that is an argument for the "inner command"
Would it be possible to pass arguments from commandline to dobi jobs?
I can kind of work around it with env variables but it's quite klunky.