Skip to content

Commit b21d29f

Browse files
committed
chore: Use our distroless base image instead of Ubuntu-based image
Motivation: - Reduce image size - Reduce unnecessary dependencies in the image (reduce attack surface) Modifications: Build the demo store Docker image from our distroless base image (gatlingcorp/openjdk-base) rather than from Zulu's Ubuntu-based image (azul/zulu-openjdk).
1 parent 1690dc9 commit b21d29f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
FROM maven:3-openjdk-17 AS build
1+
FROM maven:3-openjdk-17 AS builder
22

33
COPY ./pom.xml /build/pom.xml
44

55
WORKDIR /build
66

7-
RUN mvn dependency:resolve
7+
RUN mvn --batch-mode dependency:resolve
88

99
COPY . /build
1010

11-
RUN mvn clean package
11+
RUN mvn --batch-mode clean package
1212

13-
FROM azul/zulu-openjdk:17.0.6-jre-headless
13+
RUN chmod -R g=u /build/target/demo-store-*.jar
1414

15-
COPY --from=build /build/target/demo-store-*.jar /demo-store.jar
15+
FROM gatlingcorp/openjdk-base:17-jre-headless
16+
LABEL gatling="demostore"
1617

17-
CMD ["java", "-jar", "/demo-store.jar"]
18+
COPY --from=builder --chown=1001:0 /build/target/demo-store-*.jar /app/demo-store.jar
19+
20+
WORKDIR /app
21+
ENV HOME=/app
22+
USER 1001
23+
24+
EXPOSE 8080
25+
ENTRYPOINT ["java", "-jar", "./demo-store.jar"]
26+
CMD []

0 commit comments

Comments
 (0)