Update the version of openjdk8
[holmes/engine-management.git] / engine-d-standalone / src / main / assembly / Dockerfile
1 FROM openresty/openresty:alpine
2
3 MAINTAINER "Guangrong Fu" <fu.guangrong@zte.com.cn>
4
5 EXPOSE 9102 9202
6
7 ENV HOSTNAME=holmes-engine-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-r2
12
13 #add the backend package to the docker image
14 WORKDIR /home/holmes
15 ADD holmes-engine-d-standalone-*-linux64.tar.gz /home/holmes/
16
17 # add a simple script that can auto-detect the appropriate JAVA_HOME value
18 # based on whether the JDK or only the JRE is installed
19 RUN { \
20         echo '#!/bin/sh'; \
21         echo 'set -e'; \
22         echo; \
23         echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
24     } > /usr/local/bin/docker-java-home \
25     && chmod +x /usr/local/bin/docker-java-home \
26     && set -x \
27     #install java-1.8-openjdk
28     && apk add --no-cache openjdk8="$JAVA_ALPINE_VERSION" \
29     && [ "$JAVA_HOME" = "$(docker-java-home)" ] \
30     #install neccessary tools
31     && apk upgrade \
32     && apk update \
33     && apk add --no-cache curl \
34     && apk add --no-cache wget \
35     && apk add --no-cache postgresql-client=11.5-r0 \
36     && apk add --no-cache nss \
37
38     #switch the user to holmes
39     && addgroup -S holmes && adduser -S -G holmes holmes \
40
41     && chmod -R a+rw /home/holmes/ \
42     && chmod -R a+rw /var/log/ \
43     && chmod 755 /home/holmes/bin/*.sh
44
45 USER holmes
46
47 CMD ["sh", "/home/holmes/bin/run.sh"]
48