File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 22# Copyright (c) lucko - licenced MIT
33
44# --------------
5- # BUILD STAGE
5+ # BUILD JRE STAGE
66# --------------
7- FROM alpine as build
8-
9- # install jdk17 and binutils (for objcopy, needed by jlink)
10- RUN apk add --no-cache openjdk17 binutils
7+ FROM alpine as build-jre
8+ RUN apk add --no-cache openjdk17
9+ RUN apk add --no-cache binutils
1110
1211# create a minimal JRE
1312RUN jlink \
@@ -18,14 +17,19 @@ RUN jlink \
1817 --compress=2 \
1918 --output /jre
2019
21- # install maven
22- RUN apk add maven
20+
21+ # --------------
22+ # BUILD PROJECT STAGE
23+ # --------------
24+ FROM alpine as build-project
25+ RUN apk add --no-cache openjdk17
26+ RUN apk add --no-cache maven
2327
2428# compile the project
2529WORKDIR /bytebin
2630COPY pom.xml ./
2731COPY src/ ./src/
28- RUN mvn -B package
32+ RUN mvn --no-transfer-progress - B package
2933
3034
3135# --------------
@@ -36,14 +40,14 @@ FROM alpine
3640# copy JRE from build stage
3741ENV JAVA_HOME=/opt/java
3842ENV PATH "${JAVA_HOME}/bin:${PATH}"
39- COPY --from=build /jre $JAVA_HOME
43+ COPY --from=build-jre /jre $JAVA_HOME
4044
4145RUN addgroup -S bytebin && adduser -S -G bytebin bytebin
4246USER bytebin
4347
4448# copy app from build stage
4549WORKDIR /opt/bytebin
46- COPY --from=build /bytebin/target/bytebin.jar .
50+ COPY --from=build-project /bytebin/target/bytebin.jar .
4751
4852# define a volume for the stored content
4953RUN mkdir content logs db
You can’t perform that action at this time.
0 commit comments