FROM openjdk:8 AS TEMP_BUILD_IMAGE
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
COPY build.gradle.kts settings.gradle.kts init.gradle gradlew $APP_HOME
COPY gradle $APP_HOME/gradle
COPY init.gradle /root/.gradle/init.gradle
RUN ./gradlew build --info --stacktrace || return 0
COPY . .
RUN ./gradlew build --info --stacktrace
FROM openjdk:8
ENV ARTIFACT_NAME=xxxxx.jar
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
COPY --from=TEMP_BUILD_IMAGE $APP_HOME/build/libs/$ARTIFACT_NAME .
EXPOSE 8088
CMD ["java","-jar","xxxxx.jar"]