Dockerfile 701 B

1234567891011121314151617181920212223242526272829303132
  1. FROM python:3.11.11-slim
  2. RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
  3. # 设置工作目录
  4. WORKDIR /app
  5. # 设置环境变量
  6. ENV PYTHONUNBUFFERED=1 \
  7. PYTHONDONTWRITEBYTECODE=1 \
  8. PIP_NO_CACHE_DIR=1
  9. # 安装系统依赖
  10. RUN apt-get update && apt-get install -y --no-install-recommends \
  11. build-essential \
  12. libmagic1 \
  13. && rm -rf /var/lib/apt/lists/*
  14. # 复制项目文件
  15. COPY . .
  16. # ENV MONGODB=mongodb://root:root@172.31.69.25:37018/
  17. # ENV ALIYUN_FUNCTION_URL=https://imagefeature-hauveswkcf.cn-hangzhou.fcapp.run
  18. # 安装Python依赖
  19. RUN pip install --no-cache-dir -r requirements.txt
  20. EXPOSE 5000
  21. # 设置默认命令
  22. CMD ["python", "app.py"]