Update the version of openjdk8
[holmes/rule-management.git] / rulemgt-standalone / src / main / assembly / Dockerfile
1 FROM openresty/openresty:alpine
2
3 MAINTAINER "Guangrong Fu" <fu.guangrong@zte.com.cn>
4
5 EXPOSE 9101 9104 9201
6
7 ENV HOSTNAME=holmes-rule-mgmt \
8     LANG=C.UTF-8 \
9     JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk \
10     PATH=$PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin \
11     JAVA_ALPINE_VERSION=8.242.08-r0 \
12     PG_VERSION=12.2-r0
13
14 #add the backend package to the docker image
15 WORKDIR /home/holmes
16 ADD holmes-rulemgt-standalone-*-linux64.tar.gz /home/holmes/
17
18 #RUN mkdir /etc/ssl/private
19 ADD holmes-rulemgt-frontend-*.tar.gz /usr/local/openresty/nginx/html/
20 ADD nginx-https.conf /usr/local/openresty/nginx/conf
21 ADD nginx-http.conf /usr/local/openresty/nginx/conf
22 ADD holmes-frontend.key /etc/ssl/private
23 ADD holmes-frontend-selfsigned.crt /etc/ssl/certs
24 ADD dhparam.pem /etc/ssl/certs
25
26 #install java-1.8-openjdk
27
28 # add a simple script that can auto-detect the appropriate JAVA_HOME value
29 # based on whether the JDK or only the JRE is installed
30 RUN { \
31                 echo '#!/bin/sh'; \
32                 echo 'set -e'; \
33                 echo; \
34                 echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
35         } > /usr/local/bin/docker-java-home \
36         && chmod +x /usr/local/bin/docker-java-home \
37         && set -x \
38         && apk upgrade \
39     && apk update \
40     && apk add --no-cache openjdk8="$JAVA_ALPINE_VERSION" \
41     && [ "$JAVA_HOME" = "$(docker-java-home)" ]  \
42     #install neccessary tools
43     && apk add --no-cache curl \
44     && apk add --no-cache postgresql-client="$PG_VERSION" \
45     && apk add --no-cache nss \
46     #add the frontend pacakge to the docker images
47     && rm /etc/nginx/conf.d/default.conf \
48     && chmod -R 777 /usr/local/openresty/nginx/ \
49     #switch the user to holmes
50     && addgroup -S holmes && adduser -S -G holmes holmes \
51     && chmod -R a+rw /home/holmes/ \
52     && chmod -R a+rw /var/log/ \
53     && chmod 755 /home/holmes/bin/*.sh
54
55 USER holmes
56 CMD ["sh", "/home/holmes/bin/run.sh"]
57