From df9877a76ce131f9ed1cc1f187847bc5ef5cf814 Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Fri, 17 Jul 2020 13:06:11 +0000 Subject: Run in Python 3.8 Use image recommended by SECCOM Issue-ID: DCAEGEN2-2292 Signed-off-by: Michal Jagiello Change-Id: I52a358f22c5f9c2e1cad4b574105c8bda10acf25 --- Dockerfile | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index df26a59..db32b24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,23 @@ -FROM python:3.7-alpine +FROM python:3.8.2-alpine3.11 MAINTAINER tommy@research.att.com -COPY . /tmp -WORKDIR /tmp - EXPOSE 10000 # it is an ONAP requirement to make, and switch to, a non root user -ENV CBSUSER cbs -RUN addgroup -S $CBSUSER && adduser -S -G $CBSUSER $CBSUSER +ARG user=onap +ARG group=onap +RUN addgroup -S $group && adduser -S -D -h /home/$user $user $group && \ + chown -R $user:$group /home/$user && \ + mkdir /var/log/$user && \ + chown -R $user:$group /var/log/$user && \ + mkdir /app && \ + chown -R $user:$group /app +WORKDIR /app + +COPY . /app -# create logs dir and install # alpine does not come with GCC like the standard "python" docker base does, which the install needs, see https://wiki.alpinelinux.org/wiki/GCC -RUN apk add build-base && \ - mkdir -p /opt/logs/ && \ - chown $CBSUSER:$CBSUSER /opt/logs && \ +RUN apk add build-base libffi-dev && \ pip install --upgrade pip && \ pip install . @@ -22,5 +25,5 @@ RUN apk add build-base && \ ENV PROD_LOGGING 1 # Run the application -USER $CBSUSER +USER $user CMD run.py -- cgit 1.2.3-korg