notdiamond2api2 / Dockerfile
dan92's picture
Upload 2 files
f58c29b verified
raw
history blame
635 Bytes
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 复制依赖文件
COPY requirements.txt .
# 安装 gunicorn 和其他依赖
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt gunicorn
# 复制应用程序文件
COPY app.py .
COPY register_bot.py .
# 设置环境变量
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV PYTHONUNBUFFERED=1
# 暴露端口
EXPOSE 3000
# 使用 gunicorn 作为生产级 WSGI 服务器,添加超时和保活设置
CMD ["gunicorn", "--bind", "0.0.0.0:3000", "--workers", "4", "--timeout", "120", "--keep-alive", "5", "--worker-class", "sync", "app:app"]