Add to path in multistage build

I can not append a variable or absolute path to $PATH in a multistage alpine image.

Tried

ARG VAR=/path/to/append

ENV PATH="$VAR:${PATH}"
ENV PATH "$PATH:$VAR"
ENV PATH="/path/to/append:${PATH}"
ENV PATH "$PATH:/path/to/append"

Then when I look at $PATH in the container in bash the /path/to/append is not there.

I also tried

echo "export PATH=$VAR:${PATH}" >> /root/.bashrc

That did append to the $PATH but the issue is when there are 2 paths only the last one gets appended.

That is

ARG VAR=/path/to/append/1
ARG TWO=/path/to/append/2

echo "export PATH=$VAR:${PATH}" >> /root/.bashrc &&
echo "export PATH=$TWO:${PATH}" >> /root/.bashrc
echo $PATH
/path/to/append/2

Thank you :slight_smile:

Thank you very much :).