jupyterhub / repo2docker

Turn repositories into Jupyter-enabled Docker images
https://repo2docker.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.62k stars 360 forks source link

Add support for Java #780

Open nuest opened 5 years ago

nuest commented 5 years ago

Proposed change

Add support for installing Java and Java build tools.

Relevant package managers:

What the BuildPack would do is

Alternative options

Users would have to install Java and build tools/project managers manually, e.g. using postBuild.

Who would use this feature?

Java users.

How much effort will adding it take?

Depending on how many build tools are supported (could of course be added later) I guess 2 days of work. A good part of that would be to create different project configurations for tests.

Who can do this work?

Somebody familiar with BuildPacks and Java, and the different Java build tools.

nuest commented 4 years ago

I might have a good reason to try this out early next year, just adding a few notes. There are options to run Java from Jupyter Notebooks, one of which should be included by default.

IJava already somehow supports Binder! https://mybinder.org/v2/gh/SpencerPark/ijava-binder/master?urlpath=lab/tree/home/jovyan/3rdPartyDependency.ipynb > https://github.com/SpencerPark/ijava-binder has a custom Dockerfile.

Pinging @SpencerPark - have you thought about adding Java support natively in repo2docker? Just want to make sure I'm not missing any big obstacles here.

nuest commented 4 years ago

The official kernel list also lists most of the above projects: https://github.com/jupyter/jupyter/wiki/Jupyter-kernels

melaniewalsh commented 4 years ago

Just wanted to upvote this idea! @nuest @SpencerPark

betatim commented 4 years ago

Do you want to give implementing this a try @melaniewalsh ?

SpencerPark commented 4 years ago

Hi all, I'm happy to help out where I can but have little experience with Docker. Had to use docker classroom to build the dockerfile used in the ijava-binder :p The Dockerfile over there is super simple, the base layer (forgive my docker terminology) is some stable jdk which is itself based on some linux layer (I think ubuntu). So it just installs python and jupyter on top of that and runs the ijava install.

The docs look a bit different than the last time I visited but https://mybinder.readthedocs.io/en/latest/sample_repos.html#minimal-dockerfiles-for-binder contains everything I based the Docker file on.

IJava is intentionally light on the dependencies for an easy install, just jupyter (and the transitive dep, python) and a jdk. The default kernel.json picks up java from the $PATH, jshell is distributed with the jdk and the rest of the libs are packaged with the kernel so the only system dep is the jdk.

So a few naive questions:

  1. What is a buildpack?
  2. What does "adding it natively in repo2docker" mean? Specifically for users either creating, extending, or consuming, repos?
betatim commented 4 years ago

A build pack is a class in repo2docker that does two things. 1) it has a method that when pointed at a directory can decide if this build pack should be applied and 2) a method that generates statements that should be added in the Dockerfile repo2docker generates. In more detail: https://repo2docker.readthedocs.io/en/latest/architecture.html#buildpacks

"adding it natively" means that as a user I wouldn't have to write a Dockerfile any more. Placing for example a pom.xml at the root of my repository would be enough to trigger the installation of the jdk, ijava and packages listed in the pom.xml file.