From be58fd206aff244707e8d8db9272d3ac615a4625 Mon Sep 17 00:00:00 2001 From: MohanKumarAmbati Date: Thu, 10 Oct 2024 23:09:20 +0530 Subject: [PATCH] updated docker file, such that application runs using non-root user. --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index d30fe2db54e35..6725596502344 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,10 @@ LABEL fly.version=$version # Run the server using production configs. ENV NODE_ENV=production +# Create and Run the app as non-root user +RUN addgroup appgroup && adduser -S -G appgroup appuser +USER appuser + WORKDIR /usr/src/app COPY --from=builder --chown=0:0 /usr/src/app /usr/src/app