kscript
kscript copied to clipboard
Can't warm up when building image: $HOME/.sdkman/candidates/kscript/current/bin/kscript: line 36: kotlin: command not found
The script is working but slow at start when running the container, I'm trying to warm up Kscript by calling it inside image building:
FROM alpine
RUN set -eux &&
apk add --clean-protected --no-cache
bash
zip
sudo
openjdk11-jre
curl &&
curl -s "https://get.sdkman.io" | bash &&
/bin/bash -c "source $HOME/.sdkman/bin/sdkman-init.sh; sdk version; sdk install kotlin; sdk install kscript" &&
export SDKMAN_DIR="$HOME/.sdkman" &&
/bin/bash -c "source $HOME/.sdkman/bin/sdkman-init.sh" &&
$HOME/.sdkman/candidates/kscript/current/bin/kscript --helpRUN $HOME/.sdkman/candidates/kscript/current/bin/kscript ./LoadPass.kts warm-up &&
sleep 30
Got
Installing: kscript 3.0.2 Done installing!
Setting kscript 3.0.2 as default.
- export 'SDKMAN_DIR=/root/.sdkman'
- /bin/bash -c 'source /root/.sdkman/bin/sdkman-init.sh'
- /root/.sdkman/candidates/kscript/current/bin/kscript --help /root/.sdkman/candidates/kscript/current/bin/kscript: line 36: kotlin: command not found Removing intermediate container 346755f7973f ---> c532acd3cd7b Step 3/3 : RUN $HOME/.sdkman/candidates/kscript/current/bin/kscript ./LoadPass.kts warm-up && sleep 30 ---> Running in 43df94b745dc /root/.sdkman/candidates/kscript/current/bin/kscript: line 36: kotlin: command not found Removing intermediate container 43df94b745dc ---> 2d2657ff242a
I'd think this is because you do it in a single pass of sdk install
. I'd suspect that the PATH is not adjusted incrementally when doing so. As a simple workaround, you could use a second pass
as done in https://github.com/holgerbrandl/kscript/blob/master/misc/Dockerfile
Does this answer your question?