Skip to content

Instantly share code, notes, and snippets.

@0OZ
Created November 9, 2022 15:01
Show Gist options
  • Save 0OZ/8e65fdd5513716fe59f0d19b737653ef to your computer and use it in GitHub Desktop.
Save 0OZ/8e65fdd5513716fe59f0d19b737653ef to your computer and use it in GitHub Desktop.
Docker build example for Spring Boot application with multiply services
FROM gradle:7.4.2-alpine AS build
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
ARG SERVICE
RUN gradle :${SERVICE}:bootJar --no-daemon --stacktrace
#FROM openjdk:11.0.12-jre-slim
FROM adoptopenjdk/openjdk11-openj9:x86_64-alpine-jre-11.0.15_10_openj9-0.32.0
WORKDIR /app
ARG SERVICE
COPY --from=build /home/gradle/src/${SERVICE}/build/libs/${SERVICE}.jar ./app.jar
EXPOSE 8080
CMD ["java", "-Xverify:none", "-XX:+UnlockExperimentalVMOptions", "-Djava.security.egd=file:/dev/./urandom","-jar","app.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment