34.3 Build and Run Docker image in Docker EC2 (#34, #32)

This commit is contained in:
Art
2021-09-26 10:32:15 +03:00
parent 962393ff4e
commit b7e91fb427
3 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,25 @@
FROM openjdk:11-jre-slim as builder
WORKDIR application
ADD maven/${project.build.finalName}.jar ${project.build.finalName}.jar
RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract
FROM openjdk:11-jre-slim
RUN apt update && apt install -y curl
HEALTHCHECK --interval=5s --timeout=2s --start-period=10s --retries=5 \
CMD curl -f localhost:8080/actuator/health || false
LABEL PROJECT_NAME=${project.artifactId} \
PROJECT=${project.id}
EXPOSE 8080
ENV SERVER_PORT=8080
WORKDIR application
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "org.springframework.boot.loader.JarLauncher"]