This commit is contained in:
丹尼尔
2026-03-12 22:10:01 +08:00
parent ad96272ab6
commit a609f81a36
5 changed files with 85 additions and 2 deletions

14
Dockerfile.backend Normal file
View File

@@ -0,0 +1,14 @@
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11-slim
ENV MODULE_NAME=backend.app.main
ENV VARIABLE_NAME=app
ENV PORT=8000
ENV HOST=0.0.0.0
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
COPY backend /app/backend

View File

@@ -32,9 +32,24 @@ def _classify_type(subject: str) -> str:
Classify finance document type based on subject keywords. Classify finance document type based on subject keywords.
""" """
subject_lower = subject.lower() subject_lower = subject.lower()
if any(k in subject for k in ["发票", "invoice"]): # 发票 / 开票类
if any(k in subject for k in ["发票", "开票", "票据", "invoice"]):
return "invoices" return "invoices"
if any(k in subject for k in ["流水", "bank", "对账单", "statement"]): # 银行流水 / 账户明细 / 对公活期等
if any(
k in subject
for k in [
"流水",
"活期",
"活期明细",
"对公",
"明细",
"回单",
"bank",
"对账单",
"statement",
]
):
return "bank_records" return "bank_records"
if any(k in subject for k in ["回执", "receipt"]): if any(k in subject for k in ["回执", "receipt"]):
return "receipts" return "receipts"

23
docker-compose.yml Normal file
View File

@@ -0,0 +1,23 @@
services:
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: ops-core-backend
env_file:
- .env
volumes:
- ./data:/app/data
ports:
- "8000:8000"
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: ops-core-frontend
ports:
- "3000:3000"
depends_on:
- backend

13
docker_dev.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# 使用 Docker Compose 一键构建并启动 FastAPI + Next.js
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${SCRIPT_DIR}"
echo "[Ops-Core] 使用 Docker 构建并启动服务 (backend + frontend)..."
docker compose -f docker-compose.yml up --build
# 如需后台模式,可改为:
# docker compose -f docker-compose.yml up --build -d

18
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM node:20-alpine
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "start"]