You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
FROM alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/node:20.16 AS build-stage
|
|
USER root
|
|
|
|
RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json
|
|
|
|
RUN rm -f /etc/localtime && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
|
|
|
|
# dnf 安装 Chromium 及其依赖
|
|
RUN dnf update -y && dnf install -y \
|
|
chromium \
|
|
nss \
|
|
freetype \
|
|
freetype-devel \
|
|
fontconfig \
|
|
ca-certificates \
|
|
curl \
|
|
&& dnf clean all
|
|
|
|
# 设置 Playwright 使用系统安装的 Chromium
|
|
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
|
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
|
|
|
# 🔧 安装 Pandoc + LibreOffice + 中文字体 + Poppler(PDF 转图片所需工具)
|
|
RUN dnf update -y && \
|
|
dnf install -y \
|
|
# 文档转换工具:Pandoc
|
|
pandoc \
|
|
# LibreOffice(无头模式,支持 .doc/.docx 转换)
|
|
libreoffice-core \
|
|
libreoffice-writer \
|
|
libreoffice-calc \
|
|
libreoffice-headless \
|
|
# 中日韩字体(避免中文乱码)
|
|
wqy-microhei-fonts \
|
|
# 常用西文 fallback 字体
|
|
liberation-fonts \
|
|
# Poppler 工具集
|
|
poppler-utils && \
|
|
# 清理缓存,减小镜像体积
|
|
dnf clean all && \
|
|
rm -rf /var/cache/dnf
|
|
|
|
WORKDIR /app
|
|
|
|
# COPY package*.json ./
|
|
COPY package.json ./
|
|
COPY .npmrc ./
|
|
|
|
RUN npm config set fetch-timeout 60000 # 设置请求超时时间为 60 秒
|
|
RUN npm config set fetch-retries 5 # 设置重试次数
|
|
|
|
RUN npm cache clean -f
|
|
RUN npm i --loglevel=http
|
|
|
|
COPY . /app
|
|
|
|
ENV SOFFICE_PATH=/usr/bin/soffice
|
|
ENV NODE_ENV=production
|
|
ENV PORT=8080
|
|
|
|
EXPOSE 8080
|
|
CMD ["npm", "start"]
|
|
|