llzai commited on
Commit
bf86ba9
·
verified ·
1 Parent(s): 6d0cdca

Upload 2 files

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -7
Dockerfile CHANGED
@@ -1,7 +1,10 @@
1
  # AxonHub Hugging Face Spaces Dockerfile
2
- #
3
  # 此 Dockerfile 专为 Hugging Face Spaces 部署优化
4
  # 使用 PostgreSQL 作为数据库(需要配置外部数据库)
 
 
 
5
 
6
  # ============================================
7
  # Stage 1: 构建前端
@@ -13,16 +16,15 @@ WORKDIR /build
13
  # 启用 pnpm
14
  RUN corepack enable && corepack prepare pnpm@latest --activate
15
 
16
- # 复制依赖文件
17
- COPY frontend/package.json frontend/pnpm-lock.yaml ./
 
 
18
 
19
  # 安装依赖
20
  RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
21
  pnpm install --frozen-lockfile
22
 
23
- # 复制前端源码
24
- COPY ./frontend .
25
-
26
  # 构建前端(增加 Node.js 内存限制)
27
  ENV NODE_OPTIONS="--max-old-space-size=4096"
28
  RUN pnpm build
@@ -31,7 +33,7 @@ RUN pnpm build
31
  # Stage 2: 复制前端构建产物
32
  # ============================================
33
  FROM alpine AS frontend-dist
34
- COPY --from=frontend-builder /build/dist /dist
35
 
36
  # ============================================
37
  # Stage 3: 构建后端
 
1
  # AxonHub Hugging Face Spaces Dockerfile
2
+ #
3
  # 此 Dockerfile 专为 Hugging Face Spaces 部署优化
4
  # 使用 PostgreSQL 作为数据库(需要配置外部数据库)
5
+ #
6
+ # 重要:此文件需要复制到项目根目录使用
7
+ # cp hf/Dockerfile ./Dockerfile
8
 
9
  # ============================================
10
  # Stage 1: 构建前端
 
16
  # 启用 pnpm
17
  RUN corepack enable && corepack prepare pnpm@latest --activate
18
 
19
+ # 复制前端目录
20
+ COPY frontend ./frontend
21
+
22
+ WORKDIR /build/frontend
23
 
24
  # 安装依赖
25
  RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
26
  pnpm install --frozen-lockfile
27
 
 
 
 
28
  # 构建前端(增加 Node.js 内存限制)
29
  ENV NODE_OPTIONS="--max-old-space-size=4096"
30
  RUN pnpm build
 
33
  # Stage 2: 复制前端构建产物
34
  # ============================================
35
  FROM alpine AS frontend-dist
36
+ COPY --from=frontend-builder /build/frontend/dist /dist
37
 
38
  # ============================================
39
  # Stage 3: 构建后端