0

I have a dockerfile and I'm trying to set the value of an ARG based on whether or not an if condition is true or not. So ARG would be different depending on the result of the if condition.

I'm wondering if something like this is possible or if there's another workaround to this problem

ENV text $TEXT
ARG value= if (text == "hi") /path1; else /path2
WORKDIR ${value}

koonig
  • 67
  • 4
  • An `ARG` value you could specify via a `docker build --build-arg` option. `ARG` is not one of the directives that supports [environment replacement](https://docs.docker.com/engine/reference/builder/#environment-replacement); an `ARG` value can't depend on an `ENV` value, and it's hard to compute `ENV` (see the linked question). – David Maze Jul 10 '23 at 16:55

0 Answers0