From Docker docs:
The default shell for the shell form can be changed using the SHELL
command.
In the shell form you can use a \ (backslash) to continue a single RUN
instruction onto the next line. For example, consider these two lines:
RUN /bin/bash -c 'source $HOME/.bashrc ;\ echo $HOME' Together they
are equivalent to this single line: RUN /bin/bash -c 'source
$HOME/.bashrc ; echo $HOME'
Note: To use a different shell, other than ‘/bin/sh’, use the exec
form passing in the desired shell. For example, RUN ["/bin/bash",
"-c", "echo hello"]
You could try:
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.25.0/install.sh | bash
# RUN source ~/.profile
RUN ["/bin/bash", "-c", "source ~/.profile"]