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