Skip to content

Commit

Permalink
add non-root user in dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tunacicek committed Feb 22, 2024
1 parent f46c54f commit 26e2b92
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26e2b92

Please sign in to comment.