forked from yuanter/SpringBootDemo1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (45 loc) · 1.69 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM centos:centos7
ENV SHELL /bin/bash
MAINTAINER yuanter
# set timezone
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo ${TZ} > /etc/timezone
RUN set -eux
ENV JAVA_HOME /usr/java/openjdk-8
ENV JRE_HOME=$JAVA_HOME/jre
ENV JAVA_PATH=$JAVA_HOME/bin:$JRE_HOME/bin
ENV CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
ENV PATH=$PATH:$JAVA_HOME/bin
# Default to UTF-8 file.encoding
ENV LANG en_US.UTF-8
RUN arch="$(uname -m)"&& echo "$(uname -m)"; \
mkdir -p "$JAVA_HOME";
ADD arm/openjdk-8 /arm/openjdk-8
ADD amd/openjdk-8 /amd/openjdk-8
RUN arch="$(uname -m)"&& echo "$(uname -m)";\
case "$arch" in \
'x86_64') \
# tar -zxvf ~/OpenJDK8U-jdk_x64_linux_8u322b06.tar.gz -C $PWD/$arch/ \
mv /amd/openjdk-8 /usr/java \
;; \
'aarch64') \
# tar -zxvf ~/OpenJDK8U-jdk_aarch64_linux_8u322b06.tar.gz -C $PWD/$arch/ \
mv /arm/openjdk-8 /usr/java \
;; \
'armv7l') \
# tar -zxvf ~/OpenJDK8U-jdk_aarch64_linux_8u322b06.tar.gz -C $PWD/$arch/ \
mv /arm/openjdk-8 /usr/java \
;; \
*) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \
esac; \
echo "export JAVA_HOME=$JAVA_HOME" >> /etc/profile \
&& echo "export JRE_HOME=\$JAVA_HOME/jre" >> /etc/profile \
&& echo "export JAVA_PATH=\$JAVA_HOME/bin:\$JRE_HOME/bin" >> /etc/profile \
&& echo "export CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib:\$CLASSPATH" >> /etc/profile \
&& echo "export PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/profile \
&& source /etc/profile
ADD demo-latest.jar demo.jar
ADD application.yml application.yml
EXPOSE 8080
ENTRYPOINT ["nohup","java","-server","-Xms64m","-Xmx128m","-Djava.security.egd=file:/dev/./urandom","-jar","-Dfile.encoding=UTF-8","demo.jar","&"]