Files
MoWenAdmin-Api/Dockerfile
2026-05-14 16:35:50 +08:00

15 lines
646 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 使用你自建的精简 JRE 基础镜像(非 root, JVM 优化, 时区等已配置)
FROM moshangjunmowen/jdk-jre:v17.0.19
ARG JAR_FILE
LABEL maintainer="moshangjunmowen@foxmail.com"
# 复制 JAR 并设置所有权给非 root 用户 appuser (uid=1001)
COPY --chown=appuser:appuser ${JAR_FILE} /app/app.jar
# 通过追加 JAVA_TOOL_OPTIONS 来安全注入额外 JVM 参数
# 注意:基础镜像已设定 -Xmx1024M -Xms256M这里合并不会覆盖
ENV JAVA_TOOL_OPTIONS="-Djava.security.egd=file:/dev/./urandom ${JAVA_TOOL_OPTIONS}"
# 保持基础镜像的 ENTRYPOINT ["java", "-jar"],只需指定 jar 路径
CMD ["/app/app.jar"]