feat: add Docker support for containerized deployment

This commit is contained in:
赵杰 Jie Zhao (雄狮汽车科技)
2025-11-02 23:55:54 +08:00
parent cad03268f3
commit 2ab6aafc6f
6 changed files with 424 additions and 0 deletions

38
Dockerfile.dev Normal file
View File

@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# 开发环境Dockerfile
FROM python:3.11-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
FLASK_APP=web_app.py \
FLASK_ENV=development
# 安装系统依赖
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-chi-sim \
tesseract-ocr-eng \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# 复制requirements文件
COPY requirements.txt .
# 安装Python依赖
RUN pip install --no-cache-dir -r requirements.txt
# 复制应用代码
COPY . .
# 创建必要的目录
RUN mkdir -p templates static/css static/js logs data models
# 暴露端口
EXPOSE 5000
# 开发模式使用Flask开发服务器
CMD ["python", "start_web.py"]