This commit is contained in:
DengDai
2025-12-08 14:31:21 +08:00
commit ad2c65affb
35 changed files with 3500 additions and 0 deletions

25
Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
# 使用官方 Python 运行时作为基础镜像
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 复制 requirements.txt 文件到工作目录
COPY requirements.txt .
# 安装项目依赖
RUN pip install --no-cache-dir -r requirements.txt
# 复制项目代码到工作目录
COPY . .
# 创建非 root 用户
RUN useradd --create-home --shell /bin/bash app && \
chown -R app:app /app
USER app
# 暴露端口
EXPOSE 5000
# 使用 Flask 内置服务器运行应用(生产环境建议使用 Gunicorn
CMD ["python", "app.py"]