File tree 1 file changed +14
-10
lines changed
1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 2
2
# Copyright (c) lucko - licenced MIT
3
3
4
4
# --------------
5
- # BUILD STAGE
5
+ # BUILD JRE STAGE
6
6
# --------------
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
11
10
12
11
# create a minimal JRE
13
12
RUN jlink \
@@ -18,14 +17,19 @@ RUN jlink \
18
17
--compress=2 \
19
18
--output /jre
20
19
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
23
27
24
28
# compile the project
25
29
WORKDIR /bytebin
26
30
COPY pom.xml ./
27
31
COPY src/ ./src/
28
- RUN mvn -B package
32
+ RUN mvn --no-transfer-progress - B package
29
33
30
34
31
35
# --------------
@@ -36,14 +40,14 @@ FROM alpine
36
40
# copy JRE from build stage
37
41
ENV JAVA_HOME=/opt/java
38
42
ENV PATH "${JAVA_HOME}/bin:${PATH}"
39
- COPY --from=build /jre $JAVA_HOME
43
+ COPY --from=build-jre /jre $JAVA_HOME
40
44
41
45
RUN addgroup -S bytebin && adduser -S -G bytebin bytebin
42
46
USER bytebin
43
47
44
48
# copy app from build stage
45
49
WORKDIR /opt/bytebin
46
- COPY --from=build /bytebin/target/bytebin.jar .
50
+ COPY --from=build-project /bytebin/target/bytebin.jar .
47
51
48
52
# define a volume for the stored content
49
53
RUN mkdir content logs db
You can’t perform that action at this time.
0 commit comments