Created
March 7, 2019 15:14
-
-
Save nieldw/6033d52b5686f05053db0d0b56ddfefc to your computer and use it in GitHub Desktop.
Caching gradle binaries in a docker build when using the gradle wrapper
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
# Stage 1, build container | |
ARG VERSION=8u181 | |
FROM openjdk:${VERSION}-jdk-slim as BUILD | |
# Get gradle distribution | |
COPY *.gradle gradle.* gradlew /src/ | |
COPY gradle /src/gradle | |
WORKDIR /src | |
RUN ./gradlew --version | |
COPY . . | |
ENV MAIN_CLASS_NAME=com.example.App | |
RUN ./gradlew --no-daemon shadowJar | |
# Stage 2, distribution container | |
FROM openjdk:${VERSION}-jre-slim | |
COPY --from=BUILD /src/build/libs/app-all.jar /bin/run.jar | |
CMD ["java", "-d64", "-jar", "/bin/run.jar"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment