-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
30 lines (24 loc) · 962 Bytes
/
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
# Build
FROM maven:3.8.4-openjdk-8 AS build-env
WORKDIR /usr/src/app
COPY service/pom.xml service/pom.xml
COPY service-base/pom.xml service-base/pom.xml
COPY pom.xml settings.xml ./
RUN mvn -B -e -s settings.xml dependency:go-offline
COPY . .
RUN mvn -B -e -s settings.xml clean package -DskipTests
# Package
FROM openjdk:8u322 AS serve-env
WORKDIR /app
COPY deploy/wait-for-it.sh /app/wait-for-it.sh
RUN chmod +x /app/wait-for-it.sh
COPY --from=build-env /usr/src/app/service/target/*.jar /app/app.jar
# -Djava.security.egd=file:/dev/urandom
# Accelerate the processs of generating secure random number for variouse Java libraries
# -Duser.timezone=Asia/Shanghai
# Change the system timezone to Asia/Shanghai
ENV JAVA_OPTS="-Djava.security.egd=file:/dev/urandom -Duser.timezone=Asia/Shanghai"
ENV SERVER_PORT 8080
# Keep target port identical with port in application.yaml
EXPOSE 8080
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app/app.jar" ]