66a5aa76b94ebf918ae1b497c87632d627c7dd6b
[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:16.04
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 apt-get update -y \
39     && apt-get install -y --no-install-recommends vim unzip wget libmpfr-dev ca-certificates\
40     && apt-get install -y --no-install-recommends git libqt5printsupport5 build-essential \
41     && apt-get install -y --no-install-recommends python3 python3-setuptools python3-dev \
42     && easy_install3 pip \
43     && pip install --no-cache-dir --upgrade virtualenv pip wheel setuptools && rm -rf /var/lib/apt/lists/*
44
45 RUN ln -s /usr/bin/python3.5 /usr/bin/python
46
47 # Minizinc
48 RUN wget -q $MZN_DL_URL -O /tmp/mz.tgz \
49     && tar xzf /tmp/mz.tgz \
50     && mv $MZN_BASENAME /mz-dist \
51     && rm /tmp/mz.tgz \
52     && echo PATH=/mz-dist/bin:$PATH >> ~/.bashrc
53
54 ENV SHELL /bin/bash
55 ENV PATH /mz-dist/bin:$PATH
56
57 # OSDF
58 WORKDIR /opt/osdf
59 #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" && \
60 #    unzip -q -o -B /opt/osdf.zip -d /opt/ && \
61 #    rm -f /opt/osdf.zip
62 RUN groupadd onap \
63     && useradd -m -g onap onap
64
65 COPY onap-osdf-tm/optf-osdf-${MVN_ARTIFACT_VERSION}.zip /tmp/optf-osdf.zip
66 COPY onap-osdf-tm/apps /opt/osdf/apps
67 RUN unzip -q -o -B /tmp/optf-osdf.zip -d /opt/ && rm -f /tmp/optf-osdf.zip
68 RUN mkdir -p /usr/local/share/ca-certificates \
69     && cp /opt/osdf/ssl_certs/aaf_root_ca.cer /usr/local/share/ca-certificates/aafcacert.crt \
70     && chmod 444 /usr/local/share/ca-certificates/aafcacert.crt \
71     && update-ca-certificates
72
73 RUN mkdir -p /var/log/onap/optf/osdf/ \
74     && chown -R onap:onap /var/log/onap \
75     && chown -R onap:onap /opt/osdf
76
77 RUN pip install --no-cache-dir -r requirements.txt -r requirements-osdf.txt
78
79 USER onap
80
81 CMD [ "/opt/osdf/osdfapp.sh", "-x", "osdfapp.py" ]