Initial commit

This commit is contained in:
2026-02-01 21:30:08 +08:00
commit 60e39b98ac
7 changed files with 236 additions and 0 deletions

33
Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
# 1⃣ 安装系统依赖 + Tesseract + 语言包
RUN apt-get update && \
apt-get install -y \
tesseract-ocr \
tesseract-ocr-chi-sim \
tesseract-ocr-eng \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# 2⃣ 设置工作目录
WORKDIR /app
# 3⃣ 先拷贝依赖清单(利用 Docker 缓存)
COPY requirements.txt .
# 4⃣ 安装 Python 依赖(包含 python-dotenv
RUN pip3 install --no-cache-dir -r requirements.txt
# 5⃣ 拷贝业务代码
COPY . .
# 6⃣ 设置生产环境 Tesseract 路径环境变量
ENV TESSERACT_CMD=/usr/bin/tesseract
# 7⃣ 启动 FastAPI单进程稳定
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]