I have a Dockerfile that receives a PYTHON_VERSION ARG. I need both the full version for and the major versions only for FROM commands. Something like this:
ARG PYTHON_VERSION # assume 3.10.10 FROM gcr.io/something/image:${PYTHON_VERSION} ... FROM gcr.io/something_else/image:{PYTHON_MAJOR_VERSION} In bash I can easily extract this with sed -En 's/^([0-9]+[.][0-9]+).*/\1/p' (and probably million other options). Can I do something similar in Dockerfile? Either running a regex (but the output should go to a variable), or assign the output of a RUN command to a variable?
I'm currently using two ARGs but that seems stupid...