Change PTL of VNFSDK to be Dan Xu
[vnfsdk/refrepo.git] / vnfmarket-be / deployment / docker / docker-refrepo / src / main / docker / Dockerfile
1 # Copyright 2020 Huawei Technologies Co., Ltd.
2 # Copyright 2020 Nokia
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # vnf-sdk-marketplace/target/Dockerfile
17 #
18
19 # 10-basebuild.txt
20
21 FROM openjdk:11-jre-slim
22 ARG DEBIAN_FRONTEND=noninteractive
23
24 ENV JAVA_VERSION_MAJOR=11 \
25     JAVA_VERSION_MINOR=08 \
26     JAVA_HOME=/usr/lib/jvm/default-jvm \
27     PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/ \
28     CATALINA_HOME=/service
29
30 # Install required libraries
31 RUN apt-get update && apt-get install -y \
32     curl \
33     procps \
34     g++ \
35     make \
36     nano \
37     nginx \
38     sudo \
39     unzip \
40     wget \
41  && rm -rf /var/lib/apt/lists/* \
42  && sudo mkdir -p /usr/lib/jvm/default-jvm \
43  && sudo ln -s /usr/local/openjdk-11/* /usr/lib/jvm/default-jvm
44
45 # Installing Node
46 ENV NVM_DIR /usr/local/nvm
47 ENV NODE_VERSION 14.16.0
48 SHELL ["/bin/bash", "--login", "-i", "-c"]
49 RUN mkdir -p $NVM_DIR && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | NVM_DIR=$NVM_DIR bash
50 RUN source /root/.bashrc && nvm install $NODE_VERSION
51 SHELL ["/bin/bash", "--login", "-c"]
52 ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
53 ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
54
55 # Download and set up Tomcat
56 WORKDIR /service
57 RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz && \
58     tar --strip-components=1 -xf apache-tomcat-8.5.30.tar.gz && \
59     rm -f apache-tomcat-8.5.30.tar.gz && rm -rf webapps && mkdir -p webapps/ROOT && \
60     echo 'export CATALINA_OPTS="$CATALINA_OPTS -Xms64m -Xmx256m -XX:MaxPermSize=64m"' > /service/bin/setenv.sh
61
62 # Copy artifacts
63 WORKDIR /service
64 COPY nginx.conf /etc/nginx/nginx.conf
65 COPY certgen.sh /service
66 COPY instance-config.sh .
67 COPY instance-init.sh .
68 COPY instance-run.sh .
69 COPY instance-workaround.sh .
70 COPY docker-entrypoint.sh .
71 COPY install-vtp.sh .
72 COPY vtp-tc.sh .
73 COPY LICENSE ./ONAP_LICENSE
74
75 # Configure NGINX
76 RUN mkdir -p /etc/nginx/ssl && \
77     chown -R www-data:www-data /var/lib/nginx
78
79 # Generate certificates
80 RUN chmod +x /service/certgen.sh  && \
81     /service/certgen.sh
82
83 # Set up microservice
84 ADD ./STAGE  /service
85 RUN chmod +x /service/bin/*.sh && \
86     cd /service/webapps/onapui/vnfmarket && \
87     npm install phantomjs-prebuilt@2.1.14 --ignore-scripts && \
88     npm install
89
90 # VTP setup
91 RUN chmod a+x /service/install-vtp.sh && \
92     chmod a+x /service/vtp-tc.sh && \
93     /service/install-vtp.sh
94
95 # Create group and user
96 RUN groupadd -r vnfadmin && useradd -m --no-log-init -r -g vnfadmin vnfadmin && \
97     usermod -aG sudo vnfadmin && echo "vnfadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
98     chmod -R 777 /usr/local/
99
100 USER vnfadmin
101
102 # Define mountable directories.
103 VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/certs", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"]
104
105 EXPOSE 8702
106 EXPOSE 8703
107 EXPOSE 50051
108
109 ENTRYPOINT ["/service/docker-entrypoint.sh"]