f23889771c9c6b8bbcbcf4a722200f35060216d3
[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 # This file was auto-generated by gen-all-dockerfiles.sh; do not modify manually.
17 #
18 # vnf-sdk-marketplace/target/Dockerfile
19 #
20
21 # 10-basebuild.txt
22
23 FROM ubuntu:16.04
24 #RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
25 RUN apt-get install -y
26 RUN apt-get update --fix-missing -y
27 RUN apt-get install wget -y
28
29 WORKDIR /service
30
31
32
33 ENV JAVA_VERSION_MAJOR=11 \
34     JAVA_VERSION_MINOR=111 \
35     JAVA_HOME=/usr/lib/jvm/default-jvm \
36     PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/
37
38 RUN DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade
39 RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python-software-properties
40 RUN DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common sudo
41
42 RUN add-apt-repository ppa:openjdk-r/ppa -y && \
43     # update data from repositories
44     apt-get update --fix-missing -y && \
45     # upgrade OS
46     apt-get -y dist-upgrade && \
47     # Make info file about this build
48     printf "Build of java:openjdk-11-jre-headless, date: %s\n"  `date -u +"%Y-%m-%dT%H:%M:%SZ"` > /service/java && \
49     # install application
50     apt-get install -y --no-install-recommends openjdk-11-jre-headless && \
51     # fix default setting
52     ln -s java-11-openjdk-amd64  /usr/lib/jvm/default-jvm && \
53     # remove apt cache from image
54     apt-get clean all
55
56 # Set up tomcat
57 RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz && tar --strip-components=1 -xf apache-tomcat-8.5.30.tar.gz && rm -f apache-tomcat-8.5.30.tar.gz && rm -rf webapps && mkdir -p webapps/ROOT
58 RUN echo 'export CATALINA_OPTS="$CATALINA_OPTS -Xms64m -Xmx256m -XX:MaxPermSize=64m"' > /service/bin/setenv.sh
59 ENV CATALINA_HOME /service
60
61
62 # Set up microservice
63 #ADD ./STAGE  /service
64 #RUN apt-get install -y g++ make &&  curl -sL https://rpm.nodesource.com/setup_6.x |  bash -
65 #RUN apt-get install -y nodejs
66 #RUN apt-get install -y npm
67 #RUN cd /service/webapps/onapui/vnfmarket &&  npm install phantomjs-prebuilt@2.1.14 --ignore-scripts &&  npm install
68
69
70
71 RUN add-apt-repository -y ppa:nginx/stable && \
72   apt-get update && \
73   apt-get install -y nginx && \
74   rm -rf /var/lib/apt/lists/* && \
75   echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
76   chown -R www-data:www-data /var/lib/nginx
77
78 # Define mountable directories.
79 VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/certs", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"]
80
81 # Define working directory.
82 WORKDIR /etc/nginx
83
84 #CMD ["nginx"]
85
86
87 EXPOSE 8702
88 EXPOSE 8703
89
90 WORKDIR /service
91
92 RUN  mkdir -p /etc/nginx/ssl
93 COPY nginx.conf /etc/nginx/nginx.conf
94 COPY certgen.sh /service
95 RUN  chmod +x /service/certgen.sh
96 RUN  /service/certgen.sh
97
98
99
100 RUN apt-get update && apt-get install nano -y
101 RUN apt-get install curl -y
102
103
104 #RUN apt-get install vim -y
105
106
107 COPY instance-config.sh .
108 COPY instance-init.sh .
109 COPY instance-run.sh .
110 COPY instance-workaround.sh .
111 COPY docker-entrypoint.sh .
112 COPY install-vtp.sh .
113 COPY vtp-tc.sh .
114
115
116 # Set up microservice
117 ADD ./STAGE  /service
118 RUN apt-get install -y g++ make &&  curl -sL https://rpm.nodesource.com/setup_6.x
119 RUN apt-get install -y nodejs
120 RUN apt-get install -y npm
121 RUN apt-get -qq update && apt-get -qq -y install bzip2
122 RUN chmod +x /service/bin/*.sh
123 RUN service nginx start &
124 RUN cd /service/webapps/onapui/vnfmarket && npm install phantomjs-prebuilt@2.1.14 --ignore-scripts && npm install
125
126 #VTP setup
127 RUN chmod a+x /service/install-vtp.sh
128 RUN chmod a+x /service/vtp-tc.sh
129 RUN /service/install-vtp.sh
130 EXPOSE 50051
131
132 RUN groupadd -r vnfadmin && useradd -m --no-log-init -r -g vnfadmin vnfadmin && \
133     usermod -aG sudo vnfadmin && echo "vnfadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
134     chmod -R 777 /usr/local/
135
136 USER vnfadmin
137
138 RUN umask 000 && sudo chmod +x /service/bin/*.sh /service/*.sh && \
139     mkdir -p /service/logs && mkdir -p /var/log/nginx/ && \
140     sudo chown -R vnfadmin:vnfadmin /var/log/nginx/ && \
141     sudo chown -R vnfadmin:vnfadmin /service/ /opt/vtp /var/log && \
142     sudo chmod -R +w /service/ /opt/vtp /var/log && \
143     sudo touch /run/nginx.pid && sudo chown -R vnfadmin:vnfadmin /run/nginx.pid && \
144     chmod +w /run/nginx.pid  && sudo chown -R vnfadmin:vnfadmin /var/log/nginx/ && \
145     sudo usermod -aG www-data vnfadmin && sudo chmod -R a+w /var/lib/nginx
146
147
148 #ENTRYPOINT /service/docker-entrypoint.sh
149 ENTRYPOINT ["/service/docker-entrypoint.sh"]
150
151
152
153 COPY LICENSE ./ONAP_LICENSE