FROM python:3.9-slim WORKDIR /app # 升级 pip,安装 mysqlclient 编译依赖 RUN apt-get update && apt-get install -y \ default-libmysqlclient-dev \ build-essential \ pkg-config \ && pip install --upgrade pip setuptools wheel \ && rm -rf /var/lib/apt/lists/* # 复制 requirements COPY requirements.txt /app/ # 安装 Python 依赖 RUN pip install --no-cache-dir -r requirements.txt \ && pip install --no-cache-dir gunicorn # 复制项目文件 COPY . /app/ # 创建日志目录 RUN mkdir -p /app/logs # 暴露端口 EXPOSE 8889 # 启动命令 CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:8889", "VSeesResourceWeb.wsgi"]