Upgrade osdf python to 3.8
[optf/osdf.git] / docker / osdf / Dockerfile
1 #
2 # -------------------------------------------------------------------------
3 #   Copyright (c) 2018 AT&T Intellectual Property
4 #
5 #   Licensed under the Apache License, Version 2.0 (the "License");
6 #   you may not use this file except in compliance with the License.
7 #   You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #   Unless required by applicable law or agreed to in writing, software
12 #   distributed under the License is distributed on an "AS IS" BASIS,
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #   See the License for the specific language governing permissions and
15 #   limitations under the License.
16 #
17 # -------------------------------------------------------------------------
18 #
19
20 FROM ubuntu:20.04
21
22 ARG MVN_ARTIFACT_VERSION
23 ARG REPO
24 ARG HTTP_PROXY=${HTTP_PROXY}
25 ARG HTTPS_PROXY=${HTTPS_PROXY}
26 ARG DEBIAN_FRONTEND=noninteractive
27
28 ENV http_proxy $HTTP_PROXY
29 ENV https_proxy $HTTPS_PROXY
30
31 ENV OSDF_PORT "8699"
32 EXPOSE ${OSDF_PORT}
33
34 RUN apt-get update -y \
35     && apt-get install -y --no-install-recommends software-properties-common wget \
36     curl ca-certificates vim unzip zip git binutils binfmt-support build-essential  \
37     python3 python3-setuptools python3-dev \
38     && ln -s /usr/bin/python3.8 /usr/bin/python \
39     && curl -s https://bootstrap.pypa.io/get-pip.py | python \
40     && python -m pip --no-cache-dir  install --upgrade pip wheel setuptools && rm -rf /var/lib/apt/lists/*
41
42 ARG MZN_DL_URL=https://github.com/MiniZinc/MiniZincIDE/releases/download/2.4.3/MiniZincIDE-2.4.3-bundle-linux-x86_64.tgz
43
44 # Minizinc
45 RUN wget -q $MZN_DL_URL -O /tmp/mz.tgz \
46     && mkdir -p /mz-dist && tar xzf /tmp/mz.tgz -C /mz-dist --strip-components 1\
47     && rm /tmp/mz.tgz
48
49 ENV SHELL /bin/bash
50 ENV PATH /mz-dist/bin:$PATH
51
52 # OSDF
53 WORKDIR /opt/osdf
54 #RUN wget -O /opt/osdf.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=releases&g=org.onap.optf.osdf&a=optf-osdf&e=zip&v=1.3.4" && \
55 #    unzip -q -o -B /opt/osdf.zip -d /opt/ && \
56 #    rm -f /opt/osdf.zip
57 RUN groupadd onap \
58     && useradd -m -g onap onap
59
60 COPY onap-osdf-tm/optf-osdf-${MVN_ARTIFACT_VERSION}.zip /tmp/optf-osdf.zip
61 COPY onap-osdf-tm/apps /opt/osdf/apps
62 RUN unzip -q -o -B /tmp/optf-osdf.zip -d /opt/ && rm -f /tmp/optf-osdf.zip
63 RUN mkdir -p /usr/local/share/ca-certificates \
64     && cp /opt/osdf/ssl_certs/aaf_root_ca.cer /usr/local/share/ca-certificates/aafcacert.crt \
65     && chmod 444 /usr/local/share/ca-certificates/aafcacert.crt \
66     && update-ca-certificates
67
68 RUN mkdir -p /var/log/onap/optf/osdf/ \
69     && chown -R onap:onap /var/log/onap \
70     && chown -R onap:onap /opt/osdf
71
72 RUN python -m pip install --no-cache-dir -r requirements.txt -r requirements-osdf.txt
73
74 USER onap
75
76 CMD [ "/opt/osdf/osdfapp.sh", "-x", "osdfapp.py" ]