From 21beb1872b021612ea9bf04148a2d380b2553c28 Mon Sep 17 00:00:00 2001 From: casulit Date: Mon, 14 Oct 2024 15:31:06 +0800 Subject: [PATCH] chore(Dockerfile): Ensure non-root user 'deno' exists before adding --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ab8d6a5..13af937 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,13 @@ WORKDIR /app COPY --from=builder /app/server /app/server -# Create a non-root user -RUN addgroup --system deno && adduser --system --ingroup deno deno +# Create a non-root user if it doesn't exist +RUN if ! getent group deno > /dev/null 2>&1; then \ + addgroup --system deno; \ + fi && \ + if ! getent passwd deno > /dev/null 2>&1; then \ + adduser --system --ingroup deno deno; \ + fi # Set environment variables ENV DENO_DIR=/deno-dir