First of all, create a build_internal.sh file and paste all such conditionals to it
if [ "$AUTH_MS_PROFILE" = "test" ]; then
mvn verify
fi
Copy this file inside and then run it inside the dockerfile. I you want to try what you were trying then do:
RUN if [ "$AUTH_MS_PROFILE" = "test" ]; then mvn verify ; fi