-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
33 lines (31 loc) · 1.61 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
FROM maven:3-eclipse-temurin-21-alpine AS build
ARG VER=SNAPSHOT
COPY application /tmp/application
COPY frontend /tmp/frontend
COPY modules /tmp/modules
COPY pom.xml /tmp/pom.xml
COPY templates /tmp/templates
WORKDIR /tmp
RUN --mount=type=cache,target=/root/.m2,source=/cache/.m2,from=ghcr.io/scc-digitalhub/digitalhub-core:cache \
mvn -Drevision=${VER} install -pl modules/commons
RUN --mount=type=cache,target=/root/.m2,source=/cache/.m2,from=ghcr.io/scc-digitalhub/digitalhub-core:cache \
--mount=type=cache,target=/tmp/frontend/target,source=/cache/frontend/target,from=ghcr.io/scc-digitalhub/digitalhub-core:cache \
--mount=type=cache,target=/tmp/frontend/console/node_modules,source=/cache/frontend/console/node_modules,from=ghcr.io/scc-digitalhub/digitalhub-core:cache \
mvn -Drevision=${VER} install -pl frontend
RUN --mount=type=cache,target=/root/.m2,source=/cache/.m2,from=ghcr.io/scc-digitalhub/digitalhub-core:cache \
mvn -Drevision=${VER} package -pl '!frontend'
FROM maven:3-eclipse-temurin-21-alpine as builder
WORKDIR /tmp
COPY --from=build /tmp/application/target/*.jar /tmp/
RUN java -Djarmode=layertools -jar *.jar extract
FROM gcr.io/distroless/java21-debian12:nonroot
ENV APP=core.jar
WORKDIR /app
LABEL org.opencontainers.image.source=https://github.com/scc-digitalhub/digitalhub-core
COPY --from=builder /tmp/dependencies/ ./
COPY --from=builder /tmp/snapshot-dependencies/ ./
COPY --from=builder /tmp/spring-boot-loader/ ./
COPY --from=builder /tmp/dh-dependencies/ ./
COPY --from=builder /tmp/application/ ./
EXPOSE 8080
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]