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