forked from comeonzhj/AutoContents
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (38 loc) · 1.56 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (38 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ────────────────────────────────────────────
# Stage 1: 构建前端
# ────────────────────────────────────────────
FROM node:20-slim AS frontend-builder
WORKDIR /frontend
COPY frontend/package*.json ./
RUN npm install --omit=dev --prefer-offline
COPY frontend/ ./
ENV REACT_APP_API_URL=/api
RUN npm run build
# ────────────────────────────────────────────
# Stage 2: 生产镜像
# ────────────────────────────────────────────
FROM node:20-slim
# 安装 Chromium、中文字体和 fontconfig
RUN apt-get update && apt-get install -y \
chromium \
fonts-noto-cjk \
fontconfig \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# 安装 Apple Color Emoji 字体到系统字体目录,让 Chromium 可以 local() 引用
COPY fonts/AppleColorEmoji-Linux.ttf /usr/local/share/fonts/AppleColorEmoji.ttf
RUN fc-cache -f /usr/local/share/fonts/
WORKDIR /app
COPY backend/package*.json ./
RUN npm install --omit=dev --prefer-offline
COPY backend/ ./
COPY fonts/ ../fonts/
COPY --from=frontend-builder /frontend/build ./frontend/build
RUN mkdir -p data uploads/images uploads/rendered uploads/emoji_cache
EXPOSE 3710
CMD ["node", "index.js"]