This commit is contained in:
parent
9e3b938db7
commit
29674ba68b
21
Dockerfile
21
Dockerfile
|
@ -1,22 +1,15 @@
|
|||
# 使用官方 Python 基础镜像
|
||||
FROM python:3.11-slim
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 安装系统依赖(如果需要)
|
||||
#RUN apt-get update && apt-get install -y \
|
||||
# build-essential \
|
||||
# && rm -rf /var/lib/apt/lists/*
|
||||
# 复制 requirements.txt 并优先安装依赖(利用 Docker 层缓存)
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
|
||||
|
||||
# 复制项目文件
|
||||
COPY . /app
|
||||
# 复制整个项目
|
||||
COPY . .
|
||||
|
||||
# 安装 Python 依赖
|
||||
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 5000
|
||||
|
||||
# 启动命令(使用 Gunicorn 替代 Flask 开发服务器)
|
||||
CMD ["waitress-serve", "--host=0.0.0.0", "--port=5000", "app:app"]
|
||||
# 确保模块名和 Flask 实例名正确(默认是 app:app)
|
||||
CMD ["waitress-serve", "--host=0.0.0.0", "--port=5000", "app:app"]
|
Loading…
Reference in New Issue