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