Last active
November 30, 2019 19:19
-
-
Save durimkryeziu/8f5cfb87577b5b997b57bf3a5b0a385a to your computer and use it in GitHub Desktop.
Spring Boot Docker | Gradle | Multi-Stage Build
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
# Gradle version of this: https://spring.io/guides/topicals/spring-boot-docker/#_multi_stage_build | |
FROM azul/zulu-openjdk-alpine:11.0.5 as build | |
WORKDIR /workspace/app/ | |
COPY gradlew . | |
COPY gradle gradle | |
COPY build.gradle settings.gradle /workspace/app/ | |
COPY src src | |
ENV GRADLE_OPTS -Dorg.gradle.daemon=false -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false | |
RUN ./gradlew build | |
RUN mkdir -p build/dependency && (cd build/dependency; jar -xf ../libs/*.jar) | |
FROM azul/zulu-openjdk-alpine:11.0.5-jre | |
VOLUME /tmp | |
ENV DEPENDENCY=/workspace/app/build/dependency | |
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 | |
EXPOSE 8080 | |
ENTRYPOINT ["java", "-cp", "app:app/lib/*", "com.programmingskillz.Application"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For more details, read this article: https://spring.io/guides/topicals/spring-boot-docker