From 8d4cb7a6fa6127a326254f8ea2fe2297627d6e63 Mon Sep 17 00:00:00 2001
From: Markus Frosch <markus.frosch@icinga.com>
Date: Mon, 9 Sep 2019 10:00:31 +0200
Subject: [PATCH] Switch to user build and set USER

---
 Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 3d796fd..cfcf0eb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,11 +13,6 @@ RUN apt-get update \
  && rm -rf /usr/share/doc/* /usr/share/locales/* /usr/share/man/* \
  && rm -rf /var/lib/apt/lists/*
 
-RUN groupadd -g 1000 jenkins \
- && useradd -u 1000 -g 1000 -m jenkins \
- && echo 'Defaults:jenkins !requiretty' | tee -a /etc/sudoers \
- && echo 'jenkins ALL=(ALL:ALL) NOPASSWD: ALL' | tee -a /etc/sudoers
-
 RUN curl https://packages.icinga.com/icinga.key | apt-key add - \
  && DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release) \
  && echo "deb http://packages.icinga.com/raspbian icinga-${DIST} main" > /etc/apt/sources.list.d/${DIST}-icinga.list
@@ -30,6 +25,13 @@ RUN apt-get update \
     php-cli php-htmlpurifier node-uglify \
  && rm -rf /var/lib/apt/lists/*
 
+RUN groupadd -g 1000 build \
+ && useradd -u 1000 -g 1000 -m build \
+ && echo 'Defaults:build !requiretty' | tee -a /etc/sudoers \
+ && echo 'build ALL=(ALL:ALL) NOPASSWD: ALL' | tee -a /etc/sudoers \
+ && chown build.build /usr/local/bin
+
+USER build
 RUN git clone https://git.icinga.com/build-docker/scripts.git /usr/local/bin
 ENTRYPOINT ["/usr/local/bin/icinga-build-entrypoint"]
 CMD ["icinga-build-package"]
-- 
GitLab