This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 89b6a111 chore(dockerfile): use non-root user in Docker image (#2488)
89b6a111 is described below

commit 89b6a1114f499833a7a7c420872f6d529ffa7bf0
Author: Yann Defretin <[email protected]>
AuthorDate: Wed Aug 14 08:43:56 2024 +0200

    chore(dockerfile): use non-root user in Docker image (#2488)
---
 Dockerfile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index 2ca8772c..aa6643f2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -30,7 +30,14 @@ FROM debian:bookworm-slim
 
 RUN DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get upgrade -y && 
apt-get -y install openssl ca-certificates redis-tools binutils && apt-get clean
 
-RUN mkdir /var/run/kvrocks
+# Create a dedicated non-root user and group
+RUN groupadd -r kvrocks && useradd -r -g kvrocks kvrocks
+
+RUN mkdir /var/run/kvrocks /var/lib/kvrocks && \
+    chown -R kvrocks:kvrocks /var/run/kvrocks /var/lib/kvrocks
+
+# Switch to the non-root user
+USER kvrocks
 
 VOLUME /var/lib/kvrocks
 

Reply via email to