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", "app:app"]