From 10f74c3f619f5a78dd0fe050fd29acb997947391 Mon Sep 17 00:00:00 2001 From: Karan Sharma Date: Wed, 9 Nov 2022 13:55:43 +0530 Subject: [PATCH] feat: use non root user for Dockerfile fixes https://github.com/mr-karan/calert/issues/51 --- Dockerfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c843545..120bcf0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,20 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 RUN apt-get -y update && apt install -y ca-certificates + WORKDIR /app + COPY calert.bin . COPY static/ /app/static/ COPY config.sample.toml config.toml + +ARG CALERT_GID="999" +ARG CALERT_UID="999" + +RUN addgroup --system --gid $CALERT_GID calert && \ + adduser --uid $CALERT_UID --system --ingroup calert calert && \ + chown -R calert:calert /app + +USER calert +EXPOSE 6000 + ENTRYPOINT [ "./calert.bin" ]