From 2e5965f0e70520fbf88420498a05466f179d4a3d Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Thu, 15 Aug 2024 16:44:40 -0400 Subject: [PATCH] Stop using root user in docker image. (#318) * Stop using root user in docker image. * Add end of lines. --- .dockerignore | 9 +++++++++ Dockerfile | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..87bc36df --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +# Rust related build artifacts. +/target +.cargo/ +wix/ +scripts/ +examples/ + +# Ignore output files generated by weaver +**/output/* diff --git a/Dockerfile b/Dockerfile index 4b77d4a9..73ea3cdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,13 @@ RUN cargo build --release # The runtime image FROM alpine:3.18.3 LABEL maintainer="The OpenTelemetry Authors" +RUN addgroup weaver \ + && adduser \ + --ingroup weaver \ + --no-create-home \ + --disabled-password \ + weaver WORKDIR /weaver COPY --from=weaver-build /build/target/release/weaver /weaver/weaver -ENTRYPOINT ["/weaver/weaver"] \ No newline at end of file +USER weaver +ENTRYPOINT ["/weaver/weaver"]