g2api-test / Dockerfile
misonL's picture
feat: Update default gunicorn port in Dockerfile
9bf7741
Raw
History Blame Contribute Delete
632 Bytes
# 使用官方 Python 镜像作为基础镜像
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 复制 requirements.txt 并安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制项目所有文件到工作目录
COPY . .
# 暴露 Flask 应用运行的端口
EXPOSE 5000
# 定义启动命令
# 使用 sh -c 来确保环境变量 $PORT 被正确解析
# 使用 sh -c 来确保环境变量 $PORT 被正确解析,并绑定到 0.0.0.0:$PORT
# 使用 sh -c 来确保环境变量 $PORT 被正确解析,并绑定到 0.0.0.0:$PORT
CMD ["sh", "-c", "gunicorn app:app -b 0.0.0.0:7860"]