FROM openjdk:17-jdk-alpine as build
COPY . /data
WORKDIR /data
RUN ./gradlew bootJar
RUN mv /data/build/libs/*.jar /data/spring_demo1.jar
RUN ls -la /data

FROM openjdk:17-jdk-alpine as image
RUN mkdir -p /opt/data
COPY --from=build /data/spring_demo1.jar /opt/data
RUN ls -la /opt/data
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/opt/data/spring_demo1.jar" ]