From 552a9eb2c22c7797bd02f32b44d5683856509ff9 Mon Sep 17 00:00:00 2001 From: Thomas <12407096+thomas-chauvet@users.noreply.github.com> Date: Fri, 6 Nov 2020 15:50:11 +0100 Subject: [PATCH] feat(docker): run docker image as non-root with 'akhq' user (#494) --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4f4353e11..ed8553998 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,11 @@ FROM openjdk:11-jre-slim WORKDIR /app COPY docker / ENV MICRONAUT_CONFIG_FILES=/app/application.yml -USER 10001 +# Create user +RUN useradd -ms /bin/bash akhq +# Chown to write configuration +RUN chown -R akhq /app +# Use the 'akhq' user +USER akhq ENTRYPOINT ["docker-entrypoint.sh"] CMD ["./akhq"]