﻿# 医院审计科综合管理系统 - 运行时镜像
# 说明：代码与数据不打进镜像，由 docker-compose 通过 ./app 目录挂载，
#       这样更新文件、备份数据都直接在宿主机上完成。

FROM python:3.12-slim

ARG PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUTF8=1 \
    LANG=C.UTF-8 \
    LC_ALL=C.UTF-8 \
    TZ=Asia/Shanghai \
    PIP_INDEX_URL=${PIP_INDEX_URL}

# 安装 OCR 组件（扫描件 PDF 识别），apt 使用阿里云镜像源加速
RUN sed -i 's|http://deb.debian.org|http://mirrors.aliyun.com|g; s|http://security.debian.org|http://mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources \
    && apt-get update \
    && apt-get install -y --no-install-recommends tesseract-ocr tesseract-ocr-chi-sim \
        libreoffice-writer libreoffice-calc libreoffice-impress fonts-noto-cjk \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt \
    && rm -f /tmp/requirements.txt

# 实际启动命令由 docker-compose.yml 中每个服务的 command 指定
CMD ["python", "--version"]
