d8ffc4a9d2bbb1ac15448c646c72c972b5adec5b
[optf/osdf.git] / docker / opteng / Dockerfile
1 #
2 # -------------------------------------------------------------------------
3 #   Copyright (c) 2020 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 ARG ORTOOLS_URL=https://github.com/google/or-tools/releases/download/v7.8/or-tools_ubuntu-20.04_v7.8.7959.tar.gz
44
45 # Minizinc
46 RUN wget -q $MZN_DL_URL -O /tmp/mz.tgz \
47     && mkdir -p /mz-dist && tar xzf /tmp/mz.tgz -C /mz-dist --strip-components 1\
48     && rm /tmp/mz.tgz
49
50 RUN wget -q ${ORTOOLS_URL} -O /tmp/flatzinc.tar.gz \
51     && mkdir -p /ortools \
52     && tar zxf /tmp/flatzinc.tar.gz -C /ortools --strip-components 1 \
53     && rm /tmp/flatzinc.tar.gz
54
55 ENV SHELL /bin/bash
56 ENV PATH /mz-dist/bin:$PATH
57
58 RUN groupadd onap \
59     && useradd -m -g onap onap
60
61 # OSDF
62 WORKDIR /opt/osdf
63 #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" && \
64 #    unzip -q -o -B /opt/osdf.zip -d /opt/ && \
65 #    rm -f /opt/osdf.zip
66
67 COPY onap-osdf-tm/optf-osdf-${MVN_ARTIFACT_VERSION}.zip /tmp/optf-osdf.zip
68 COPY onap-osdf-tm/runtime /opt/osdf/runtime
69 COPY onap-osdf-tm/requirements-opteng.txt .
70 RUN unzip -q -o -B /tmp/optf-osdf.zip -d /opt/ && rm -f /tmp/optf-osdf.zip
71 RUN mkdir -p /var/log/onap/optf/osdf/ \
72     && chown onap:onap /var/log/onap -R \
73     && chown onap:onap /opt/osdf -R
74
75 RUN python -m pip install --no-cache-dir -r requirements.txt -r requirements-opteng.txt
76
77 USER onap
78
79 CMD [ "/opt/osdf/osdfapp.sh", "-x", "solverapp.py", "-c", "/opt/osdf/config/opteng_config.yaml" ]