summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorwr148d <wr148d@att.com>2020-06-01 14:37:38 -0400
committerwr148d <wr148d@att.com>2020-06-01 14:37:48 -0400
commit2cdc6af6738193d052993f0991cba2db055d0cf5 (patch)
treeb090255a55b5ba9ab7311edaf199d7bcef65b3e1 /src/main
parent28c7f4683cb8321e51716cffb6ae1f0192e28f5c (diff)
Containers should not run as root by default
Issue-ID: AAI-2822 Signed-off-by: wr148d <wr148d@att.com> Change-Id: Ia6fdf7867f0732234506422bc7ed4ed8ebc380fb
Diffstat (limited to 'src/main')
-rw-r--r--src/main/docker/Dockerfile13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile
index a523778..a4da9af 100644
--- a/src/main/docker/Dockerfile
+++ b/src/main/docker/Dockerfile
@@ -3,9 +3,18 @@ FROM @aai.docker.namespace@/aai-common-@aai.base.image@:@aai.base.image.version@
ARG MICRO_HOME=/opt/app/model-loader
# Build up the deployment folder structure
-RUN mkdir -p $MICRO_HOME
+RUN mkdir -p $MICRO_HOME $MICRO_HOME/logs
+
+RUN groupadd aaiadmin -g 1000
+RUN adduser -u 1000 -h /opt/aaihome/aaiadmin -S -D -G aaiadmin -s /bin/bash aaiadmin
WORKDIR $MICRO_HOME
-COPY /maven/model-loader/ .
+
+RUN chown -R aaiadmin:aaiadmin $MICRO_HOME $MICRO_HOME/logs
+
+COPY --chown=aaiadmin:aaiadmin /maven/model-loader/ .
+
+USER aaiadmin
+
RUN chmod 755 bin/* \
&& ln -s /logs $MICRO_HOME/logs