From 3aadd714f1eae7f617127a23f5dd1e6513d3af77 Mon Sep 17 00:00:00 2001 From: mrichomme Date: Tue, 12 May 2020 15:24:49 +0200 Subject: Create Dockerfile for python3 image Issue-ID: INT-1589 Signed-off-by: mrichomme Change-Id: I5cfe4c16380878737fe45cc8a2159a71a1f4912b Signed-off-by: mrichomme --- Dockerfile | 22 ++++++++++++++++++++++ README.md | 25 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c49b78b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.8.2-alpine3.11 + +LABEL maintainer="ONAP Integration team, morgan.richomme@orange.com" +LABEL Description="Reference ONAP Python 3 image" + +ARG user=onap +ARG group=onap + +# Create a group and user +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 + +# Tell docker that all future commands should be run as the onap user +USER $user +WORKDIR /app + +ONBUILD COPY requirements.txt . +ONBUILD RUN pip install --no-cache-dir -r requirements.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f12c70 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# onap-python + +This Dockerfile aims to generate a baseline image for ONAP [1] projects +based on SECCOM recommendations [2]. + +It includes: + +- python 3.8.2 +- pip3 + +Due to the ONBUILD directive, each project must provide a requirements.txt file +before building an image derived from this baseline image. +Without this requirements.txt file, the docker built will fail. +The pip install -r requirements.txt will be executed on the build of your image. + +An example of Dockerfile consuming this base line image could be: + +``` +FROM nexus3.onap.org:10001/onap/integration-python +RUN echo "Add your specifc docker needs here." +``` + +[1]: http://wiki.onap.org + +[2]: https://wiki.onap.org/display/DW/Database%2C+Java%2C+Python%2C+Docker%2C+Kubernetes%2C+and+Image+Versions -- cgit 1.2.3-korg