From b96160bb1e6f52fd261bc3036a76c1978e7d806e Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Thu, 1 Feb 2024 09:14:53 -0800 Subject: [PATCH] Use non-root user for docker image --- crates/bws/Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/bws/Dockerfile b/crates/bws/Dockerfile index d75494648..257d04dbf 100644 --- a/crates/bws/Dockerfile +++ b/crates/bws/Dockerfile @@ -30,5 +30,12 @@ WORKDIR /usr/local/bin COPY --from=build /app/target/release/bws . COPY --from=build /etc/ssl/certs /etc/ssl/certs -ENTRYPOINT ["bws"] +# Create a non-root user +RUN useradd -ms /bin/bash app + +# Switch to the non-root user +USER app +WORKDIR /home/app + +ENTRYPOINT ["bws"]