Spaces:
Running
Running
File size: 2,691 Bytes
6e128f1 26aa6a7 6e128f1 26aa6a7 6e128f1 27fa202 6e128f1 27fa202 6e128f1 e193de8 b910fd3 4c254c4 169025e b910fd3 50b4be3 169025e 88928aa 50b4be3 88928aa dfd685f e021e08 6e128f1 | 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | # 🔮 Ziwei Doushu API Dockerfile
# Multi-stage build: Node.js + Python
# 2026-10-23: Node 18 (EOL) → 22.23.4, the patched release from the 2026-10-21 Node.js security advisory.
# Pin the exact version so a rebuild never silently picks up an older image.
FROM node:22.23.4-slim AS node-base
WORKDIR /app
# Install Node.js dependencies
COPY package*.json ./
RUN npm install --production
# Copy Node.js service
COPY ziwei_service.js ./
# Python stage
FROM python:3.11-slim
WORKDIR /app
# Node runtime: copy the patched binary + npm from the node stage instead of Debian's apt nodejs
# (apt gave Node 18, which no longer receives security fixes). npm is only a fallback for ensure_node_dependencies().
COPY --from=node-base /usr/local/bin/node /usr/local/bin/node
COPY --from=node-base /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/npm
RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && node --version && npm --version
# Copy Node.js files from previous stage
COPY --from=node-base /app/node_modules ./node_modules
COPY --from=node-base /app/package.json ./package.json
COPY --from=node-base /app/ziwei_service.js ./ziwei_service.js
# Copy Python requirements
COPY requirements.txt ./
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy Python application and modules
COPY app.py ./
COPY sihua_analyzer.py ./
COPY sihua_data.py ./
COPY ai_interpreter.py ./
# 2026-07-12 Phase 3: 四层schema(meta/strength/timing/evidence) — 漏COPY会导致
# HF Space构建后 `from evidence import ...` ImportError,务必跟app.py一起加
COPY evidence.py ./
COPY terms.py ./
# Copy v3.5+ knowledge-enhanced modules
COPY knowledge_enhanced_interpreter.py ./
COPY palace_strength.py ./
COPY star_brightness_table.py ./
# Copy v3.6 San Fang Si Zheng module
COPY san_fang_si_zheng_analyzer.py ./
# Copy v3.7 Pattern Recognition modules
COPY geju_patterns.py ./
COPY geju_matcher.py ./
# Copy v3.8 Star Combination modules
COPY star_combination_rules.py ./
COPY star_combination_matcher.py ./
# Copy v3.18 Daxun Analyzer module (NEW!)
COPY daxun_analyzer.py ./
# Copy v3.19 Resolution Advisory module (NEW!)
COPY resolution_advisor.py ./
# Copy v3.20 Liuyue Analyzer module (NEW!)
COPY liuyue_analyzer.py ./
# Copy v4.0 Barnum + Six Relations + Reading Methodology modules (NEW!)
COPY barnum_cold_reader.py ./
COPY methodology_loader.py ./
COPY six_relations_interpreter.py ./
COPY reading_methodology.py ./
# Copy remaining files
COPY README.md ./
# Expose port 7860 (required by Hugging Face Spaces)
EXPOSE 7860
# Run the FastAPI application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|