fix csit, cleanup dockerfile for osdf
[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 python:3.8-alpine
21
22 ARG MVN_ARTIFACT_VERSION
23 ARG REPO
24 ARG HTTP_PROXY=${HTTP_PROXY}
25 ARG HTTPS_PROXY=${HTTPS_PROXY}
26
27 ENV http_proxy $HTTP_PROXY
28 ENV https_proxy $HTTPS_PROXY
29
30 ENV OSDF_PORT "8699"
31 EXPOSE ${OSDF_PORT}
32
33 ENV MZN 2.4.2
34 ENV MZN_BASENAME MiniZincIDE-${MZN}-bundle-linux
35 ENV MZN_GH_BASE https://github.com/MiniZinc/MiniZincIDE
36 ENV MZN_DL_URL ${MZN_GH_BASE}/releases/download/${MZN}/${MZN_BASENAME}-x86_64.tgz
37
38 RUN apk update  && apk upgrade \
39     && apk --no-cache --update add --virtual build-deps openssl wget  \
40     && apk --no-cache --update add less ca-certificates bash libxslt-dev unzip \
41                                 freetype freetype-dev libstdc++ build-base libc6-compat lapack-dev openblas-dev \
42     && ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2 \
43     && pip install --no-cache-dir --upgrade pip wheel setuptools \
44     && pip install --no-cache-dir Cython numpy==1.17.3 scipy==1.3.1
45
46 # Minizinc
47 RUN wget -q $MZN_DL_URL -O mz.tgz \
48     && tar xzf mz.tgz \
49     && mv $MZN_BASENAME /mz-dist \
50     && rm mz.tgz \
51     && echo PATH=/mz-dist/bin:$PATH >> ~/.bashrc
52
53 ENV SHELL /bin/bash
54 ENV PATH /mz-dist/bin:$PATH
55
56 RUN addgroup -S onap && adduser -S -G onap onap
57
58 # OSDF
59 WORKDIR /opt/osdf
60 #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" && \
61 #    unzip -q -o -B /opt/osdf.zip -d /opt/ && \
62 #    rm -f /opt/osdf.zip
63
64 COPY onap-osdf-tm/optf-osdf-${MVN_ARTIFACT_VERSION}.zip /tmp/optf-osdf.zip
65 COPY onap-osdf-tm/runtime /opt/osdf/runtime
66 COPY onap-osdf-tm/requirements-opteng.txt .
67 RUN unzip -q -o -B /tmp/optf-osdf.zip -d /opt/ && rm -f /tmp/optf-osdf.zip
68 RUN mkdir -p /var/log/onap/optf/osdf/ \
69     && chown onap:onap /var/log/onap -R \
70     && chown onap:onap /opt/osdf -R
71
72 RUN pip install --no-cache-dir -r requirements.txt -r requirements-opteng.txt\
73     && apk del build-deps && rm -rf /var/cache/apk/*
74
75 USER onap
76
77 CMD [ "/opt/osdf/osdfapp.sh", "-x", "solverapp.py", "-c", "/opt/osdf/config/opteng_config.yaml" ]