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     nodejs \
39     npm \
40     sudo \
41     unzip \
42     wget \
43  && rm -rf /var/lib/apt/lists/* \
44  && sudo mkdir -p /usr/lib/jvm/default-jvm \
45  && sudo ln -s /usr/local/openjdk-11/* /usr/lib/jvm/default-jvm
46
47 # Download and set up Tomcat
48 WORKDIR /service
49 RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz && \
50     tar --strip-components=1 -xf apache-tomcat-8.5.30.tar.gz && \
51     rm -f apache-tomcat-8.5.30.tar.gz && rm -rf webapps && mkdir -p webapps/ROOT && \
52     echo 'export CATALINA_OPTS="$CATALINA_OPTS -Xms64m -Xmx256m -XX:MaxPermSize=64m"' > /service/bin/setenv.sh
53
54 # Copy artifacts
55 WORKDIR /service
56 COPY nginx.conf /etc/nginx/nginx.conf
57 COPY certgen.sh /service
58 COPY instance-config.sh .
59 COPY instance-init.sh .
60 COPY instance-run.sh .
61 COPY instance-workaround.sh .
62 COPY docker-entrypoint.sh .
63 COPY install-vtp.sh .
64 COPY vtp-tc.sh .
65 COPY LICENSE ./ONAP_LICENSE
66
67 # Configure NGINX
68 RUN mkdir -p /etc/nginx/ssl && \
69     chown -R www-data:www-data /var/lib/nginx
70
71 # Generate certificates
72 RUN chmod +x /service/certgen.sh  && \
73     /service/certgen.sh
74
75 # Set up microservice
76 ADD ./STAGE  /service
77 RUN chmod +x /service/bin/*.sh && \
78     cd /service/webapps/onapui/vnfmarket && \
79     npm install phantomjs-prebuilt@2.1.14 --ignore-scripts && \
80     npm install
81
82 # VTP setup
83 RUN chmod a+x /service/install-vtp.sh && \
84     chmod a+x /service/vtp-tc.sh && \
85     /service/install-vtp.sh
86
87 # Create group and user
88 RUN groupadd -r vnfadmin && useradd -m --no-log-init -r -g vnfadmin vnfadmin && \
89     usermod -aG sudo vnfadmin && echo "vnfadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
90     chmod -R 777 /usr/local/
91
92 USER vnfadmin
93
94 # Define mountable directories.
95 VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/certs", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"]
96
97 EXPOSE 8702
98 EXPOSE 8703
99 EXPOSE 50051
100
101 ENTRYPOINT ["/service/docker-entrypoint.sh"]