Basically I want to assign a dynamically calculated default value for ARG
in my Dockerfile:
FROM node:20-alpine
ARG RELEASE_TAG=$(git describe --tags --always)
# Other commands...
So, far it doesn’t interpolate the value of $(git describe --tags --always)
and simply assigns this value to the RELEASE_TAG
variable.
Is there any way I can achieve this?
2
Answers
You can use the
--build-arg
argument withdocker build
And inside your Dockerfile:
That way, RELEASE_TAG will now have the value of
git describe --tags --always
output.You can achieve the expected effect by putting it in RUN :