From 26e2b92b498942a4b1d7c4b5f9e970c179924bd4 Mon Sep 17 00:00:00 2001 From: Tunahan Cicek Date: Thu, 22 Feb 2024 15:38:22 +0100 Subject: [PATCH] add non-root user in dockerfile --- backend/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 49738ca..ebb4db1 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -29,12 +29,13 @@ RUN mvn clean package # step 2: build image FROM eclipse-temurin:17-jre-alpine -RUN addgroup -S spring \ - && adduser -S spring -G spring \ +RUN addgroup -g 101 -S spring \ + && adduser -u 100 -S spring -G spring \ && mkdir -p /service \ && chown spring:spring /service -USER spring:spring +USER 100:101 + WORKDIR /service COPY --from=builder /build/backend/target/bpn-discovery-backend*.jar app.jar