Automatic JRE install for VSCode Remote Containers

Hi, My team uses VSCode Remote Containers for all of our development. We develop in a Python:3.7-slim Docker container. The Remote Containers plug-in allows us to specify which VSCode plug-ins to install inside the development container and sonarsource.sonarlint-vscode is one of the plug-ins we use. This enables all of the developers to have the exact same plug-ins.

My questions is: “Is there a way to automatically download the JRE that SonarLine uses?”

Here is our situation: Our teams are Python and NodeJS developers so we don’t have Java in our docker images and adding a Java JRE 8 to our 155MB Python image, for example, would add over 614MB to it! (3x bloat!) This is undesirable. So what we currently do is allow SonarLint to add its own JRE which only requires an additional 124MB of space.

This works until the image gets rebuilt and the new image doesn’t have a JRE and SonarLint complains that it cannot find the JRE specified the settings. Thats when we have to do this little dance. Step 1: Delete the JRE path from the VSCode settings. Step 2: Reload VSCode. Step 3: When SonarLint sees the empty settings and offers to install the JRE say yes. Step 4: Reload VSCode.

My questions is how to avoid this 4 step dance every time the image is rebuilt. What I would like is a way to download the SonarLint JRE in the definition of the VSCode Remote Containers image build which is driven by a separate Dockerfile. Something like wget would be fine. We could place that in the Dockerfile to include in the image. I can’t seem to find any Java JRE that is as smalls the one SonarLint provides.

Any help would be greatly appreciated.

Where are you finding a JRE of 614MB??? That’s an insane size, you must be doing something wrong.

Hi,

SonarLint doesn’t need a JDK, but only a JRE. You can find packages for example on https://adoptopenjdk.net/

1 Like

I got that 614MB from apt-get install default-jre.

I did:

docker run --rm -it python:3.7-slim bash
$ apt-get update && apt-get install default-jre

which eventually returned:

After this operation, 614 MB of additional disk space will be used.
Do you want to continue? [Y/n]

and I was like Yikes! :open_mouth: No

@Julien_HENRY Thanks for the link. This looks like what I need but how did you get to the JRE page? I’m only seeing downloads for the JDK. :frowning:

Never mind I found it. I didn’t realize it sensed that I was on macOS and showed me Mac downloads. I went to other platforms and selected Linux and there is was.

@Julien_HENRY THANK YOU !!! This made my day. :smiley:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.