multi-stage build is used to simplify cleanup after we install the tools required to fetch OpenGrok
we ask Bash to stop pipe execution if one of the commands fail (curl/wget failed to fetch URL, jq failed to extract asset URL from JSON) and return exit code to Docker, but AFAIK the only way to utilize pipefail in Dockerfile is to make such convoluted RUN command
In hindsight: when converting the build flow recently I finally realized why the download sometimes failed - the curl was making unauthenticated API requests and thus occasionally bumped into rate limiting.
Some notes: