27 lines
1.0 KiB
Docker
27 lines
1.0 KiB
Docker
|
|
# 基础镜像
|
|
FROM openjdk:17-alpine
|
|
|
|
## 设置时区为东八区(北京时间)
|
|
#RUN apk add --no-cache tzdata \
|
|
# && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
# && echo "Asia/Shanghai" > /etc/timezone
|
|
|
|
# 复制打包后的 JAR 文件到容器中
|
|
ENV HOSTNAME="g3fo-admin"
|
|
COPY /target/g3fo-admin-service-1.0.0-SNAPSHOT.jar /app.jar
|
|
ARG JAVA_OPTS="-XX:NewRatio=1 -XX:SurvivorRatio=1 -Xss1024k -Xmx512m -Xms512m -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:/data/logs/jvm/gc.log"
|
|
ENV JAVA_OPTS=$JAVA_OPTS
|
|
ENV RUN_ARGS="--spring.cloud.nacos.discovery.ip=$HOSTNAME --dubbo.provider.host=$HOSTNAME"
|
|
# 容器启动时执行的命令
|
|
|
|
#ADD *.jar g3fo-demo-service-1.0.0-SNAPSHOT.jar
|
|
|
|
##指定配置文件,方便在容器中运行时挂载配置文件路径
|
|
#ENTRYPOINT ["java", "-jar", "/app.jar", "$RUN_ARGS"]
|
|
ENTRYPOINT java -jar /app.jar $RUN_ARGS
|
|
|
|
#ENTRYPOINT ["java", "-jar", "/app.jar"]
|
|
|
|
# 为容器设置端口映射(可选)
|
|
EXPOSE 18002 |