-
-
Save anjilinux/fa008539e6c8328c46f477e3084ae765 to your computer and use it in GitHub Desktop.
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
| # Build Stage for Spring boot application image | |
| FROM openjdk:8-jdk-alpine as build | |
| WORKDIR /app | |
| COPY mvnw . | |
| COPY .mvn .mvn | |
| COPY pom.xml . | |
| RUN chmod +x ./mvnw | |
| # download the dependency if needed or if the pom file is changed | |
| RUN ./mvnw dependency:go-offline -B | |
| COPY src src | |
| RUN ./mvnw package -DskipTests | |
| RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar) | |
| # Production Stage for Spring boot application image | |
| FROM openjdk:8-jre-alpine as production | |
| ARG DEPENDENCY=/app/target/dependency | |
| # Copy the dependency application file from build stage artifact | |
| COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib | |
| COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF | |
| COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app | |
| # Run the Spring boot application | |
| ENTRYPOINT ["java", "-cp", "app:app/lib/*","com.example.starter.StaterApplication"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment