I assume source "$HOME/.sdkman/bin/sdkman-init.sh" is responsible to set the proper paths to what is installed? If so, it must either be part of your CMD or an ENTRYPOINT script. If this is not the case, you will have to set the correct PATH using an ENV instruction in your Dockerfile.
Note: each RUN instruction will be executed in a new container, If a file is sourced or a process is started in a RUN instruction its outcomme will not be available in the following RUN instructions or the created container.
RUN instructions are to build the filesystem layers. Since you probably donât use source command to change files but to set variables in runtime, it will not work. Just imagine what happens when you set the variables in one terminal session it will not set the variables permanently.
This is why @meyay recommended running that source command in the entrypoint or command which runs when you start the container and not during build time. Or if you know the variables and the variables are not generated, you can use the ENV instruction which was also recommended by meyay. those environment variables are set in each temporary build container and also the final container which you can run from the image.