CyberpunkPerson / microservice-blank

1 stars 0 forks source link

Layered jars #6

Closed CyberpunkPerson closed 2 years ago

CyberpunkPerson commented 2 years ago
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <finalName>microservice-blank</finalName>
        <layers>
            <enabled>true</enabled>
        </layers>
    </configuration>
</plugin>

Dockerfile

FROM docker-proxy.tcsbank.ru/maven:3.8.3-openjdk-17-slim as build
COPY . .
RUN mvn -B -Dmaven.repo.local=.m2/repository package

ARG JAVA_IMAGE=docker-proxy.tcsbank.ru/eclipse-temurin:17.0.1_12-jdk
FROM ${JAVA_IMAGE} as extracter
COPY --from=build /target/social-pulse-poll.jar /app/app.jar
RUN java -Djarmode=layertools -jar /app/app.jar extract --destination /extract/

FROM ${JAVA_IMAGE}
WORKDIR app
COPY --from=extracter /extract/dependencies/ ./
COPY --from=extracter /extract/spring-boot-loader/ ./
COPY --from=extracter /extract/snapshot-dependencies/ ./
COPY --from=extracter /extract/application/ ./
CMD java org.springframework.boot.loader.JarLauncher

values.yaml

entrypoint_args:
  - "java"
  - "-Dspring.config.location=/opt/app/config/application.yaml"
  - "-Xmx256m"
  - "org.springframework.boot.loader.JarLauncher"
CyberpunkPerson commented 2 years ago

Fixed by 980059c