# Python 应用示例 FROM python:3.9-slim WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 禁用缓存减小体积 COPY . . EXPOSE 5000 USER appuser # 切换非 root 用户 CMD ["gunicorn", "app:app"]