diff options
author | wr148d <wr148d@att.com> | 2020-06-01 13:38:37 -0400 |
---|---|---|
committer | wr148d <wr148d@att.com> | 2020-06-01 13:42:42 -0400 |
commit | b5ad42615ec0c777d21af623be3e0a2f19a1c9b4 (patch) | |
tree | d5d4a40ddb87b0b52b8c5fdedeab83515d2182f8 | |
parent | 37ed422ee9c069bf07d4453e472d45eaa42bf86f (diff) |
Containers should not run as root by default
Issue-ID: AAI-2822
Change-Id: I28d5426805bbf5d60aa0cd0bc1701165f233d6a9
Signed-off-by: wr148d <wr148d@att.com>
-rw-r--r-- | src/main/docker/Dockerfile | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 03917f7..369d1b5 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/babel # 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/babel/ . + +RUN chown -R aaiadmin:aaiadmin $MICRO_HOME $MICRO_HOME/logs + +COPY --chown=aaiadmin:aaiadmin /maven/babel/ . + +USER aaiadmin + RUN chmod 755 bin/* \ && ln -s /logs $MICRO_HOME/logs |