Having read
- Can a variable be used in docker FROM?
- Using variables across multi-stage docker build
- https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
I am able to use a variable if there is only one FROM line, i.e. in a build that is NOT multi-stage.
I have been trying to make a variable work in all the FROM lines of a Dockerfile; The reason being that we have multiple teams working on the same project and they use different internal proxies. However, it does not seem to work in the first (or perhaps only works in the last) FROM line.
The Dockerfile looked something like this before I gave up (Note that I tried varying the position and qty of ARG statements and such):
ARG repo_one
ARG repo_two
FROM ${repo_one}node:12 as build
USER root
ARG repo_one
ENV GENERATE_SOURCEMAP=false
# .. do stuff ..
FROM ${repo_two}nginx:stable-alpine
ARG repo_two
# .. copy from build img, do stuff ..
EXPOSE 3000 8090
CMD ["ash", "run.sh"]
Any thoughts? Did I miss something, or is there something intentional about this?