Feat: Complete UI redesign, backend optimization, and Docker deployment support
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
# 使用官方 Python 运行时作为父镜像
|
||||
FROM python:3.9-slim
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 设置环境变量
|
||||
# 防止 Python 生成 .pyc 文件
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
# 确保 Python 输出不被缓冲
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# 安装系统依赖(如有需要)
|
||||
# RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 复制依赖文件
|
||||
COPY requirements.txt .
|
||||
|
||||
# 安装 Python 依赖
|
||||
# 使用阿里云镜像源加速
|
||||
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
|
||||
|
||||
# 复制当前目录内容到容器中的 /app
|
||||
COPY . .
|
||||
|
||||
# 创建上传目录(确保权限)
|
||||
RUN mkdir -p uploads && chmod 777 uploads
|
||||
|
||||
# 暴露端口 5000
|
||||
EXPOSE 5000
|
||||
|
||||
# 运行 app.py
|
||||
# 生产环境建议使用 gunicorn (需添加到 requirements.txt),但这里为了简单直接运行 python app.py
|
||||
CMD ["python", "app.py"]
|
||||
Reference in New Issue
Block a user