guohanghui commited on
Commit
dfdb960
·
verified ·
1 Parent(s): c55bd9a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -7
Dockerfile CHANGED
@@ -17,23 +17,38 @@ USER user
17
  ENV PATH="/home/user/.local/bin:$PATH"
18
  WORKDIR /app
19
 
20
- # 克隆完整的 pyPDAF 仓库(包含 submodule)
21
  RUN git clone --recursive https://github.com/yumengch/pyPDAF.git pyPDAF_source
22
 
23
- # 编译安装 pyPDAF
24
  WORKDIR /app/pyPDAF_source
25
- RUN pip install --no-cache-dir meson-python meson ninja cython numpy mpi4py && \
26
- pip install --no-cache-dir -v .
27
 
28
- # 回到应用目录
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  WORKDIR /app
30
 
31
  # 复制 MCP 代码
32
  COPY --chown=user ./pyPDAF/mcp_output /app/pyPDAF/mcp_output
33
  COPY --chown=user ./requirements.txt /app/requirements.txt
34
 
35
- # 修复导入语句(从 src.pyPDAF 改为 pyPDAF)
36
- RUN sed -i 's/from src\.pyPDAF/from pyPDAF/g' /app/pyPDAF/mcp_output/mcp_plugin/mcp_service.py
 
 
37
 
38
  # 安装其他依赖
39
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
17
  ENV PATH="/home/user/.local/bin:$PATH"
18
  WORKDIR /app
19
 
20
+ # 克隆 pyPDAF(包含 submodule)
21
  RUN git clone --recursive https://github.com/yumengch/pyPDAF.git pyPDAF_source
22
 
 
23
  WORKDIR /app/pyPDAF_source
 
 
24
 
25
+ # 设置 MPI 编译器环境变量
26
+ ENV MPIFC=mpifort
27
+ ENV FC=mpifort
28
+ ENV F90=mpifort
29
+
30
+ # 安装构建依赖
31
+ RUN pip install --no-cache-dir meson-python meson ninja cython numpy mpi4py
32
+
33
+ # 尝试编译安装(如果失败就跳过)
34
+ RUN pip install --no-cache-dir -v . || echo "Build failed, will try alternative"
35
+
36
+ # 如果上面失败,尝试直接使用预编译的 wheel
37
+ RUN if ! python -c "import pyPDAF" 2>/dev/null; then \
38
+ pip install --no-cache-dir pypdaf || \
39
+ echo "Both build and install failed"; \
40
+ fi
41
+
42
  WORKDIR /app
43
 
44
  # 复制 MCP 代码
45
  COPY --chown=user ./pyPDAF/mcp_output /app/pyPDAF/mcp_output
46
  COPY --chown=user ./requirements.txt /app/requirements.txt
47
 
48
+ # 修复导入语句
49
+ RUN if [ -f /app/pyPDAF/mcp_output/mcp_plugin/mcp_service.py ]; then \
50
+ sed -i 's/from src\.pyPDAF import/from pyPDAF import/g' /app/pyPDAF/mcp_output/mcp_plugin/mcp_service.py; \
51
+ fi
52
 
53
  # 安装其他依赖
54
  RUN pip install --no-cache-dir --upgrade -r requirements.txt