Initial commit
This commit is contained in:
97
docker/Dockerfile
Normal file
97
docker/Dockerfile
Normal file
@@ -0,0 +1,97 @@
|
||||
# VitePress Docker Image
|
||||
FROM node:25
|
||||
|
||||
LABEL maintainer="xeden3"
|
||||
LABEL description="VitePress Documentation with PDF Export Support"
|
||||
|
||||
# Install Chrome dependencies for PDF export (Debian)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
chromium \
|
||||
chromium-driver \
|
||||
tzdata \
|
||||
fonts-liberation \
|
||||
libnss3 \
|
||||
libatk-bridge2.0-0 \
|
||||
libxcomposite1 \
|
||||
libxdamage1 \
|
||||
libxrandr2 \
|
||||
libgbm1 \
|
||||
libasound2 \
|
||||
libpangocairo-1.0-0 \
|
||||
libgtk-3-0 \
|
||||
libxss1 \
|
||||
libglib2.0-0 \
|
||||
libxkbcommon0 \
|
||||
libdrm2 \
|
||||
libcups2 \
|
||||
libdbus-1-3 \
|
||||
# 中文字体支持(开源字体,Docker环境默认使用)
|
||||
fonts-wqy-microhei \
|
||||
fonts-wqy-zenhei \
|
||||
xfonts-intl-chinese \
|
||||
fonts-noto-cjk \
|
||||
# 俄语字体支持(DejaVu 字体包含 Cyrillic 字符)
|
||||
fonts-dejavu-core \
|
||||
# 字体缓存工具
|
||||
fontconfig \
|
||||
&& fc-cache -fv \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 提示:如果需要使用微软雅黑字体,可以从 Windows 系统复制字体文件到容器
|
||||
# Windows 字体目录:C:\Windows\Fonts\msyh.ttc (微软雅黑)
|
||||
# 将字体复制到容器:docker cp msyh.ttc <container_name>:/usr/share/fonts/truetype/
|
||||
# 然后运行:fc-cache -fv
|
||||
|
||||
# Set environment variables
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
||||
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium \
|
||||
NODE_ENV=development \
|
||||
CHROME_BIN=/usr/bin/chromium
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files for main app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install main dependencies (vitepress, etc.)
|
||||
RUN export NODE_ENV=development && \
|
||||
rm -rf node_modules package-lock.json && \
|
||||
npm install && \
|
||||
npm install vitepress-export-pdf -D && \
|
||||
npm install vitepress-plugin-mermaid mermaid && \
|
||||
npm install medium-zoom markdown-it-mathjax3
|
||||
|
||||
# Copy API service
|
||||
COPY docker/api/package*.json ./api/
|
||||
WORKDIR /app/api
|
||||
|
||||
# Install API dependencies
|
||||
RUN npm install
|
||||
|
||||
# Go back to app directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy API service files
|
||||
COPY docker/api/ ./api/
|
||||
|
||||
# Copy entry point script
|
||||
COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
# Create log directory
|
||||
RUN mkdir -p /var/log
|
||||
|
||||
# Create working directory for docs
|
||||
WORKDIR /app
|
||||
|
||||
# Expose ports
|
||||
EXPOSE ${VITEPRESS_PORT:-3000} ${API_PORT:-3001}
|
||||
|
||||
# Volume for docs and PDF output
|
||||
VOLUME ["/app/docs"]
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Entry point
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD []
|
||||
Reference in New Issue
Block a user