jruby / docker-jruby

MIT License
18 stars 27 forks source link

Slim JRE From Alpine #9

Closed moofish32 closed 8 years ago

moofish32 commented 9 years ago

The Alpine Linux crew has been hard at work making Java work with the musl libc, the issue history is here https://github.com/gliderlabs/docker-alpine/issues/11. Using the solutions discovered this is a slim JRE based JRuby container that is roughly 181 MB in size vs the ~530 MB currently. Is this something we can add the JRuby docker repo or is this too experimental? I am happy to make modifications and clean up the Dockerfile as necessary.

cpuguy83 commented 9 years ago

I wonder if we can instead improve the base java image, which is almost 500MB.

moofish32 commented 9 years ago

reading between the lines -- too experimental? I was trying to determine if I could standardize all of my current employers images to alpine. This is the key hold out. However, I haven't rolled this through our environment yet and I expect to find some bugs on the way.

I can take a look at the base image in the next week hopefully, there are probably some quick wins to drop the size closer to 300.

cpuguy83 commented 9 years ago

Yeah, I'm not sure what the deal is with the size if the JRE isn't all that big. That said, maybe @tianon wouldn't mind handling an alpine based super-slim JRE image? Then all we have to do here is load up the jruby stuff on top.

The biggest down-side is most people expect apt to be available, but if someone is looking for slim it shouldn't be hard to switch to apk.

moofish32 commented 9 years ago

agree on the apt and apk issue. I have been pleased with the alpine teams up to date apk versions. There are some fun gotchas happening such as update-alterntatives and an extra space in the sha1sum output.

Should we move this to a discussion or keep tracking in the PR or you can totally vote to close and move on.

cpuguy83 commented 9 years ago

As is, I'm can't merge it :) But we can discuss here, or on IRC in #docker-library if you like.

I'm definitely open to having a minimal version of this, but I think we'll need buy-in to do this at the base java image.

tianon commented 9 years ago

I'd personally be +1 for an "alpine" variant -- I wouldn't go with "slim" for the tag name, but I think "alpine" appropriately conveys exactly what the expectations from such a thing ought to be. :+1:

frol commented 9 years ago

I actually have a slim JRE docker image already - https://registry.hub.docker.com/u/frolvlad/alpine-oraclejdk8/, and quite some people have already used it for several months as well as I have. Don't copy this JRE installation, just use FROM frolvlad/alpine-oraclejdk8:slim (it is 167MB) and pull request if you see what we can cut out of JRE.

cpuguy83 commented 8 years ago

@frol Do you want to update this, but let's put it in an alpine dir and update the Dockerfile to match the current install procedure? If not I can carry.

Thanks!

frol commented 8 years ago

@cpuguy83 Please, go ahead. I have almost zero experience with Ruby, and absolutely zero experience with JRuby, so I won't be able to evaluate the resulting image properly. My point was that I maintain the quirks related to glibc and Oracle JDK on Alpine, and it is not a great idea to duplicate this effort (especially, if duplication is not maintained).

moofish32 commented 8 years ago

@cpuguy83 - I am not working with JRuby on my current project. I can probably lend a hand if you want help. To @frol's point we can reference his work. The previous security team was a little concerned about exactly what was modified and how the image/container would get security patches. I honestly don't know enough to even review the changes @frol did to make Java work with Alpine. Happy to lend a hand. If you want to stick with openjdk 8 and openjre 8, @frol do you have container with those configs? Then we can just follow your current pattern with an alpine dir.

frol commented 8 years ago

@moofish32 There is the official java image on Docker Hub with alpine tags for OpenJDK and OpenJRE and there is no need for GLibc hacks to run OpenJDK. If you can get away with OpenJDK, I suggest you do so!

moofish32 commented 8 years ago

@frol - thanks - @cpuguy83 -- I think your repo is all openJDK/JRE right?

cpuguy83 commented 8 years ago

Thanks, this is all done thanks to @albertogg