FROM openjdk:8-jre

# 通过挂载-v 来挂载宿主机的文件到容器中 /opt/wfc/app.jar
WORKDIR /opt/wfc

# 设置环境变量
ENV JVM_OPTS="-Xms128m -Xmx512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
ENV JAVA_OPTS="--spring.config.additional_location=optional:classpath:/,optional:file:/opt/wfc/conf/application.yml"
ENV JAR_FILE="app.jar"

# 使用 sh -c 解析环境变量
ENTRYPOINT ["sh", "-c", "java -Dfile.encoding=utf-8 ${JVM_OPTS} -jar ${JAR_FILE} ${JAVA_OPTS}"]

# docker build -t java:jre8 .
# docker run -v /home/manager/probject/wfc/wfc-gateway.jar:/app.jar java:jre8
