Last active
January 16, 2023 08:24
-
-
Save rayyildiz/22d44acda5b30025abcd261529ef4d52 to your computer and use it in GitHub Desktop.
Custom runtime for spring boot app
This file contains 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 eclipse-temurin:17 as jre-build | |
RUN $JAVA_HOME/bin/jlink \ | |
--add-modules java.base,java.sql,java.naming,java.desktop,java.management,java.security.jgss,java.instrument \ | |
--strip-debug \ | |
--no-man-pages \ | |
--no-header-files \ | |
--compress=2 \ | |
--output /javaruntime | |
FROM debian:buster-slim | |
ENV JAVA_HOME=/opt/java/openjdk | |
ENV PATH "${JAVA_HOME}/bin:${PATH}" | |
COPY --from=jre-build /javaruntime $JAVA_HOME | |
WORKDIR /apps | |
EXPOSE 8080 | |
RUN addgroup spring | |
RUN adduser --system spring --ingroup spring --no-create-home --disabled-password --disabled-login | |
USER spring:spring | |
ADD target/your-jar-0.1.0.jar /apps/app.jar | |
ENTRYPOINT ["java","-jar","/apps/app.jar"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment