Replies: 1 comment
-
I have the same issue. I just have a global variable which detects if i'm in a docker env or now. I just pass the command like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to write an invoke task that would adjust it's behavior based on whether it's running in a docker container or not.
For example, suppose I had a simple task that ran black formatting:
When
inv format
is run within my docker container, it should simply runblack myfile.py
. However, if I runinv format
on the host machine, I'd like invoke to wrap that command in a docker run statement. Suppose I have some environment variable that I can check to see if I'm running in a container (IS_DOCKER
). I could write something like this to accomplish what I want:I could probably make this a bit nicer by writing a run
run_cmd_maybe_docker
method. However, it seems like there should be a more natural invoke-style way to accomplish this using contexts and runners.Beta Was this translation helpful? Give feedback.
All reactions