Commit fa920879 by zhangxingmin

push

parent 6d17dd5c
# 使用更小的基础镜像 # 使用官方 LibreOffice 镜像作为基础
FROM openjdk:8-jre-slim FROM librepdf/oracle-jdk-8-libreoffice:latest
# 维护人 # 维护人
LABEL maintainer="zxm<2060197959@qq.com>" LABEL maintainer="zxm<2060197959@qq.com>"
# 创建目录 # 创建目录
WORKDIR /home/app RUN mkdir -p /home/app
# 设置环境变量(提前设置以利用缓存) # 拷贝项目jar
ENV LANG=zh_CN.UTF-8 \
LANGUAGE=zh_CN:zh \
LC_ALL=zh_CN.UTF-8 \
DEBIAN_FRONTEND=noninteractive
# 使用阿里云镜像源并安装必要组件(合并所有操作到一个RUN层)
RUN set -eux; \
# 备份原源文件
cp /etc/apt/sources.list /etc/apt/sources.list.bak; \
# 使用阿里云镜像源
sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list; \
sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list; \
# 更新并安装最小化包
apt-get update; \
apt-get install -y --no-install-recommends \
libreoffice-core \
libreoffice-writer \
libreoffice-l10n-zh-cn \
fonts-liberation \
fonts-dejavu-core \
fonts-wqy-microhei \
fonts-noto-cjk \
fontconfig \
locales; \
# 设置中文locale
echo "zh_CN.UTF-8 UTF-8" >> /etc/locale.gen; \
locale-gen zh_CN.UTF-8; \
# 清理缓存和临时文件
apt-get clean; \
rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/var/cache/apt/* \
/usr/share/doc/* \
/usr/share/man/*; \
# 更新字体缓存
fc-cache -f -v; \
# 验证安装
echo "=== 基础验证 ==="; \
java -version; \
libreoffice --version; \
fc-list :lang=zh | head -3
# 拷贝项目jar(放在最后以利用Docker缓存)
COPY target/yd-oss-api-1.0-SNAPSHOT-exec.jar /home/app/yd-oss-api.jar COPY target/yd-oss-api-1.0-SNAPSHOT-exec.jar /home/app/yd-oss-api.jar
# 使用 exec 形式启动,优化信号处理 # 执行命令启动jar
ENTRYPOINT ["java", "-jar", "/home/app/yd-oss-api.jar"] ENTRYPOINT ["java", "-jar", "/home/app/yd-oss-api.jar"]
# 暴露端口 # 暴露端口
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment