Created
December 28, 2021 12:50
-
-
Save torrespro/2e2dfcc21726cd3cdb203f5a9b27e019 to your computer and use it in GitHub Desktop.
A #docker container that runs #Java webserver ('jwebserver' command line tool in #jdk18) to serve javadoc. Note the use of #jlink tool to create minimal JRE with just the jdk.httpserver module + its transitive dependencies. Credit to: https://twitter.com/sundararajan_a/status/1473465961818701824
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM openjdk:18-jdk-oraclelinux8 as build | |
#minimum jre image for webserver | |
RUN jlink --add-modules jdk.httpserver --output java_http | |
RUN curl \ | |
https://download.oracle.com/otn_software/java/jdk/17.0.1+12/2a2082e5a09d4267845be086888add4f/jdk-17.0.1_doc-all.zip \ | |
--output docs.zip && \ | |
jar xvf docs.zip | |
FROM oraclelinux:8-slim | |
#copy minimal jre and docs directory | |
COPY --from=build java_http java_http | |
COPY --from=build docs docs | |
EXPOSE 8000 | |
#start webserver to serve javadoc from /docs | |
ENTRYPOINT ["/java_http/bin/jwebserver", "-b", "0.0.0.0", "-d", "/docs"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing thi.
Is oracleLinuxv8 is not jfk 8 right, need to verify after I download?
While you are creating this wouldn't this be helpful to add some non root user, can you please share and how do we start https using openssl cert?
Thanks.